I have one object which contains two different methods
var samp {
m1: func1,
m2: func2
}
Depending on the number of keys I want to call all the three function parallely Now Im using the following code which runs serially.
switch (sampType) {
case "m1":
{
return new func1();
break;
}
case "m2":
{
return new func2();
break;
}
default:
{
}
}
How can I execute all the methods parallely in node.js? Any help on this will be really helpful
Check out async.parallel. You would essentially write:
async.parallel( [
function ( callback ) {
// Code
},
function ( callback ) {
// Code
}
], function ( error, results ) {
// Both done
} );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With