async.series to handle tasks one by one
suggest changeIn async.series, the functions run one after another. The consolidated outputs of each function are passed to the final callback.
var async = require('async');
async.series([
function (callback) {
console.log('First Execute..');
callback(null, 'userPersonalData');
},
function (callback) {
console.log('Second Execute.. ');
callback(null, 'userDependentData');
}
], function (err, result) {
console.log(result);
});
// Output:
// First Execute..
// Second Execute..
// ['userPersonalData', 'userDependentData']
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents