1.2.0 • Published 10 years ago

foyer v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

foyer

NPM version build status Test coverage

Execute async functions in parallel and trigger a callback when done. Sets the context of the executed functions to itself.

Installation

$ npm i --save foyer

Example

var foyer = require('foyer');

foyer([
  function(done) {setTimeout(function(){done('myError', 'myRes');}, 10)}, 
  function(done) {done('myError2', 'myRes2')}
], function callback(err, res) {return res;});
// => ['myRes2', 'myRes']

API

foyer(functions, callback)

// Define an array of async functions.
var tasks = [
  function(done){done(null, 'hello')}, 
  function(done){done(null, 'world')}
];

// Define the callback to be executed
var cb = function(err, res){return res};

// Run 'Foyer' to execute your tasks and run the callback when finished
foyer(tasks, cb);
// => ['hello', 'world']

License

MIT © Yoshua Wuyts

1.2.0

10 years ago

1.1.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.0

10 years ago