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
But since the exports are not wrapped in an asyncblock, the sync call doesn't get transformed and the result is TypeError: an.asyncCall(...).sync is not a function
Since this all lives in an Express app, my asyncblock gets launched elsewhere, but if I do explicitly wrap the exports in an asyncblock in order to force the transform, I get this:
/bla/node_modules/asyncblock/lib/flow_fiber.js:26
this._fiber.run(task);
^
TypeError: Cannot set property '_asyncblock_flow' of null
at fiberContents (/bla/node_modules/asyncblock/lib/asyncblock.js:88:32)
Am I doing something wrong? Is there another way/is it possible to enable Transforms?
The text was updated successfully, but these errors were encountered:
module.exports = {
'bla': function() {
var flow = asyncblock.getCurrentFlow();
return flow.sync(an.asyncCall('params', flow.callback());
};
I'll think about adding something for transforms outside of an asyncblock context. The general way the library is intended to be used is more like this:
function bla(callback) {
ab(function() {
return an.asyncCall('params').sync():
}, callback);
};
So you would basically define an asyncblock every time you want to use it. That makes it compatible with the node callback pattern.
But you can do whichever you think is better for your style and use case, of course.
I'm using the following code, which works great:
It might be nice to enable Transforms and use something like this:
But since the exports are not wrapped in an asyncblock, the
sync
call doesn't get transformed and the result isTypeError: an.asyncCall(...).sync is not a function
Since this all lives in an Express app, my asyncblock gets launched elsewhere, but if I do explicitly wrap the exports in an asyncblock in order to force the transform, I get this:
Am I doing something wrong? Is there another way/is it possible to enable Transforms?
The text was updated successfully, but these errors were encountered: