-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea #3
Comments
Thanks for the suggestion. I'm not sure I can implement it exactly as you suggested, as forceWait returns the args passed to the callback from the async function. var asyncTask = function(callback) {
callback(null, 'data goes here');
};
asyncblock(function(flow){
process.nextTick(function(){
asyncTask(flow.add());
flow.doneAdding();
});
console.log(flow.forceWait()); //Prints "data goes here"
}); If I wanted to store some information for later on, I could do it just by declaring a variable: asyncblock(function(flow){
var state;
process.nextTick(function(){
asyncTask(flow.add());
state = 'something';
flow.doneAdding();
});
console.log(flow.forceWait()); //Prints "data goes here"
console.log(state); //Prints "something"
}); I'm wondering if something like that addresses your request, or if you need something I'm not seeing. I could add something like flow.setState(key, data) and flow.getState(key, data), but it seems like you can do it yourself by declaring your own variable. Thanks, Chris |
I'm going to close this for now. Feel free to re-open if needed. |
What if I could pass informations to doneAdding() and add()?
I mean this:
asynchronous(function(){
var doc = {foo : bar};
flow.doneAdding(doc);
});
console.log(flow.forceWait()); // Output {foo : bar}
Thanks for your last modifications and good holly days for you!
The text was updated successfully, but these errors were encountered: