0.2.0 • Published 12 years ago

switch-emitter v0.2.0

Weekly downloads
23
License
-
Repository
-
Last release
12 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

12 years ago

0.1.3

13 years ago

0.1.2

13 years ago

0.1.1

13 years ago

0.1.0

13 years ago