Skip to content

Execute asynchronous js functions in parallel and get their results in a common callback function.

Notifications You must be signed in to change notification settings

rentala/ParallelJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

ParallelJS

Execute asynchronous js functions in parallel and get their results in a common callback function.

##Usage

executeAsync([func1, func2, func3], function (res) {
    console.log(res);
    res[0];  //result of func1
    res[1];  //result of func2
});

Where func1, func2, func3 are your asyncronous functions. Such as:

function func1(cb) {
    setTimeout(function () {
        cb("func1");
    },300)
}
function func2(cb) {
    setTimeout(function () {
        cb("func2");
    },200)
}
function func3(cb) {
    cb({ data : "data", foo: "foo"})
}

####Note: Not to be confused with https://parallel.js.org/, a far more advanced library for way more complex problems

About

Execute asynchronous js functions in parallel and get their results in a common callback function.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published