Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 640 Bytes

section25.6.md

File metadata and controls

24 lines (20 loc) · 640 Bytes

Section 25.6: async.series(To handle events one by one)

In async.series, all the functions are executed in series and the consolidated outputs of each function is passed to the final callback.

let 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']