Socket
Book a DemoInstallSign in
Socket

simple-dispatcher

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-dispatcher

Attach multiple listeners to a single emitter

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

simple-dispatcher

NPM version build status Test coverage Downloads

Attach multiple listeners to a single emitter.

Installation

npm install simple-dispatcher

Usage

var dispatcher = require('simple-dispatcher');
var EventEmitter = require('events').EventEmitter;
var emitter = new EventEmitter();

dispatcher(emitter, {
  myEvent: [fn1, fn2],
  end: fn3
});

function fn1() {};
function fn2() {};
function fn3() {};

// dispatch event
emitter.emit('myEvent', {foo: 'bar'});

See also

License

MIT

Keywords

events

FAQs

Package last updated on 11 Nov 2014

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