Skip to content

Instantly share code, notes, and snippets.

@yelworc
Created September 17, 2014 13:03
Show Gist options
  • Save yelworc/da3a563ea73e54eb6b2c to your computer and use it in GitHub Desktop.
Save yelworc/da3a563ea73e54eb6b2c to your computer and use it in GitHub Desktop.
nested wait.for calls
var wait = require('wait.for');
function g(callback) {
setImmediate(function () {
callback(null, 'G');
});
}
function f(callback) {
var res_g = wait.for(g);
setImmediate(function () {
callback(null, 'F' + res_g);
});
}
wait.launchFiber(function () {
var res_f = wait.for(f);
console.log('alleged result of f(): ' + res_f);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment