0.2.0 • Published 11 years ago

switch-emitter v0.2.0

Weekly downloads
23
License
-
Repository
-
Last release
11 years ago

switch-emitter

Events with recipient address.

Install

$ npm install switch-emitter

Listen and emit to addressed events

var switchEmitter = require('switch-emitter');

var recipientA = switchEmitter.to('recipient-a');
var recipientB = switchEmitter.to('recipient-b');

// recipientA and recipientB are event emitters

recipientA.on('event', function(a, b) {  
  console.log('recipient A got event', arguments);
  assert.equal(a, 'a');
  assert.equal(b, 'b');
});

// Send event to recipient-a
switchEmitter.emit('recipient-a', 'event', 'a', 'b')

Licence

MIT

0.2.0

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago