function SyncFunction(){
var ret;
setTimeout(function(){
ret = "hello";
},3000);
// may be promise.then(res=>ret=res)
while(ret === undefined) {
require('deasync').sleep(100);
}
// returns hello with sleep; undefined without
return ret;
}
// may be promise.then(res=>ret=res)?
but it seems waste time to wait?
function SyncFunction(){ var ret; setTimeout(function(){
ret = "hello"; },3000);
// may be promise.then(res=>ret=res) while(ret === undefined) { require('deasync').sleep(100); } // returns hello with sleep; undefined without return ret;
}
// may be promise.then(res=>ret=res)? but it seems waste time to wait?
is there better method?