Skip to content

Instantly share code, notes, and snippets.

@tranphuoctien
Created March 21, 2016 11:45
Show Gist options
  • Save tranphuoctien/9188e1f6ce46b35ad6cc to your computer and use it in GitHub Desktop.
Save tranphuoctien/9188e1f6ce46b35ad6cc to your computer and use it in GitHub Desktop.
NodeJS Async WaterFall Example Raw
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