Skip to content

This javascript class allows to register multiple tasks and accepts another callback function to execute it after all registered callbacks are done.

Notifications You must be signed in to change notification settings

sandeshdamkondwar/javascript-concurrent-tasks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

javascript-concurrent-tasks

Javascript class that allows to register multiple callbacks to execute simulteniously(sort of) to execute a single function.

Example:

var syncFuncs = new SyncFuncs();

syncFuncs.registerTask(function() {
    $.ajax({
        url: 'http://www.coupondunia.in',
    })
    .always(function() {
        console.log("Task 1 done");
        syncFuncs.markOneDone({
            id: 1
        });
    });
});

syncFuncs.registerTask(function() {
    $.ajax({
        url: 'http://www.coupondunia.in',
    })
    .always(function() {
        console.log("Task 2 done");
        syncFuncs.markOneDone({
            id: 2
        });
    });
});

syncFuncs.registerTask(function() {
    $.ajax({
        url: 'http://www.coupondunia.in',
    })
    .always(function() {
        console.log("Task 3 done");
        syncFuncs.markOneDone({
            id: 3
        });
    });
});

syncFuncs.timout = 3000;

syncFuncs.registerFinalTask(function(outputs) {
    console.log(outputs);
});

syncFuncs.start();

About

This javascript class allows to register multiple tasks and accepts another callback function to execute it after all registered callbacks are done.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published