Created
January 20, 2013 07:08
-
-
Save cxreg/4577093 to your computer and use it in GitHub Desktop.
node async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
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