Skip to content

Instantly share code, notes, and snippets.

@arisolt
Forked from cxreg/gist:4577093
Last active December 11, 2015 08:59
Show Gist options
  • Save arisolt/4577137 to your computer and use it in GitHub Desktop.
Save arisolt/4577137 to your computer and use it in GitHub Desktop.
var async = require('async');
function one(cb) {
console.log("one");
cb();
}
function two(cb) {
function three(callback){
var a = [];
for (var i = 1; i <= 3; i++) {
a.push(i);
};
callback(null, a);
}
function four(work, callback) {
console.log(work);
callback(null);
}
async.waterfall([three, four], cb); // A cb is required by the series to proceed to the outer three().
// If cb was outside the waterfall, it would have been called too early.
}
function three(cb) {
console.log('even more');
cb();
}
async.series([one, two, three]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment