Skip to content

Instantly share code, notes, and snippets.

@VivienAdnot
Created February 23, 2018 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VivienAdnot/459e9b563c153b49cef523b4acb2b939 to your computer and use it in GitHub Desktop.
Save VivienAdnot/459e9b563c153b49cef523b4acb2b939 to your computer and use it in GitHub Desktop.
async waterfall (es5 style)
console.log('Program Start');
var async = require('async');
async.waterfall([
function (callback) {
console.log('First Step --> ');
callback(null, '1', '2');
},
function (arg1, arg2, callback) {
console.log('Second Step --> ' + arg1 + ' ' + arg2);
callback(null, '3');
},
function (arg1, callback) {
console.log('Third Step --> ' + arg1);
callback(null, 'final result');
}
], function (err, result) {
console.log('Main Callback --> ' + result);
});
console.log('Program End');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment