You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to store the results of a deferred call in a hash, I'm getting the value of the deferred object rather than the result it points to. Here's a simple program to demonstrate what's happening:
(function(){varfs=require("fs");varasyncblock=require("asyncblock");if(asyncblock.enableTransform(module)){return;}asyncblock(function(){varsynced=fs.readFile(__filename,'utf8').sync();vardeferred=fs.readFile(__filename,'utf8').defer();varhash={};hash.sync=synced;// this works just finehash.defer=deferred;// this doesn't workconsole.log(hash);console.log(deferred);// this works just fine toovard=deferred;// using an intermediate workshash.defer=d;console.log(hash);});})();
Here's the suspicious output from the hash assignment:
When I try to store the results of a deferred call in a hash, I'm getting the value of the deferred object rather than the result it points to. Here's a simple program to demonstrate what's happening:
Here's the suspicious output from the hash assignment:
The text was updated successfully, but these errors were encountered: