1.0.5 • Published 12 years ago

fanin v1.0.5

Weekly downloads
19
License
-
Repository
github
Last release
12 years ago

node-fanin Build Status

A simple concurrency pattern: fan-in

Status: Untested in production, but ready to be.

Why do you need fan-in?

  • You want to make n asynchronous calls simultaneously and make a callback when all have finished.
  • You may want to save the callback values of these calls, and definitely want the errors.
  • You just want that. Nothing else.

API

var fanin = require('fanin')
  , fan = fanin(3, cb);

foo(fan.capture('foo'));
bar(fan.capture('bar'));
baz(fan);

// cb(array_of_errs, {foo: foo_obj, bar: bar_obj}); will be called.
  • var fan = fanin(n, cb) returns a function which will act as a callback to the sub-calls in which you only care about errors.
  • fan.capture(name) will act as a callback to the sub-calls which you care about return value (placing them in an object under the key name.
  • options:
    • joinErrs is an optional argument to join the error list (it can be a string to join on or true for .join('; '))

Installation

npm install after

Tests

npm test

License

MIT License found in the LICENSE file.

1.0.5

12 years ago

1.0.4

12 years ago

1.0.3

12 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago