Skip to content

Control flow component for executing functions concurrently.

License

Notifications You must be signed in to change notification settings

konexmedia/race

Repository files navigation

race Build Status

Control flow component for executing functions concurrently. Usable in a browser or Node.js environment.

The motivation was to handle the parallel execution of functions without depending on a control flow library like async.

Installation

bower install konexmedia/race

OR

npm install konexmedia/race

Usage example

var race = require('race'); // Browser: var race = konexmedia.race;

race([
    function daFirst (callback) {
        setTimeout(function () {
            callback(null, 1);
        }, 200);
    },
    function daSecond (callback) {
        setTimeout(function () {
            callback(null, 'ehlo');
        }, 100);        
    }
])
.finish(function (err, results) {
    if (err) {
        return console.error(err);
    }
    
    console.log(results.daFirst); => 1
    console.log(results.daSecond); => 'ehlo'
});

Author

Copyright 2014, konexmedia

About

Control flow component for executing functions concurrently.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published