ydn db - ydn-db async operation need to assign value to variable -
i'm unable assign variable async operation using callback . .done
didn't assign value variable. here code :
var someglobalvar = 0; dbs.count('cfs_init').done(function(x) { console.log('total : ' + x); someglobalvar = x; }); console.log(someglobalvar); // 0
your assignment works if manually (or in settimeout function) execute console.log(someglobalvar);
, after receiving done callback.
you executing before done callback , hence still 0
.
Comments
Post a Comment