-
-
Save Rigo85/b97fa9f065ccac45a363659a13dc3df3 to your computer and use it in GitHub Desktop.
NodeJS Async WaterFall Example
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'); | |
async.waterfall( | |
[ | |
function(callback) { | |
callback(null, 'Yes', 'it'); | |
}, | |
function(arg1, arg2, callback) { | |
var caption = arg1 +' and '+ arg2; | |
callback(null, caption); | |
}, | |
function(caption, callback) { | |
caption += ' works!'; | |
callback(null, caption); | |
} | |
], | |
function (err, caption) { | |
console.log(caption); | |
// Node.js and JavaScript Rock! | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment