npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

simple-dispatcher

1.0.3

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:0
$ npm install simple-dispatcher
DailyWeeklyMonthlyYearly

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

  • event-aggregate
  • barracks

License

MIT