event-chain
A simple way to chain events and control program flow asynchronously.
This is an open source project under the MIT license, see LICENSE.md for additional information.
Install
npm install --save event-chain
Example
var chain = require('event-chain')();
var example = chain.on(['one', 'two'], function() {
console.log('foo');
});
example.emit('one');
example.emit('two');
Debug
Debugging is made possible with Debug and can be enabled by setting the
environment variable event-chain
:
env DEBUG=event-chain
API
chain.on(events, callback)
chain.on(events, callback)
chain.emit(event)
foo.emit(event);
Options
Customized options are available for the chain.
var chain = require('event-chain')(options);
options.complete (optional)
The event that is fired once all user-defined events have completed, used internally. Default: '__complete'