node.js - Run several asynchronous functions in parallel -
i have 1 object contains 2 different methods
var samp { m1: func1, m2: func2 }
depending on number of keys want call 3 function parallely im using following code runs serially.
switch (samptype) { case "m1": { return new func1(); break; } case "m2": { return new func2(); break; } default: { } }
how can execute methods parallely in node.js? on helpful
check out async.parallel. write:
async.parallel( [ function ( callback ) { // code }, function ( callback ) { // code } ], function ( error, results ) { // both done } );
Comments
Post a Comment