Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

event-chain

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-chain

A simple way to chain events and control program flow asynchronously.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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');
// foo to console.

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)
/**
 * Create an event-chain that will execute the callback after all the events have been emitted.
 *
 * @param events
 *   An array of events (string) that are required before invoking the callback.
 * @param callback
 *   A callback function to be executed after all the provided events have been fired.
 *
 * @return
 *   A Chain object.
 */
chain.on(events, callback)
chain.emit(event)
/**
 * Emit the given event for the chain.
 *
 * @param event
 *   Emit an event that was previously registered with chain.on();
 */
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'

Keywords

FAQs

Package last updated on 20 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc