Created
February 23, 2018 13:31
-
-
Save VivienAdnot/459e9b563c153b49cef523b4acb2b939 to your computer and use it in GitHub Desktop.
async waterfall (es5 style)
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
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