Propagate events from one event emitter into another.
$ npm install propagate
const ee1 = new EventEmitter()
const ee2 = new EventEmitter()
propagate(ee1, ee2)
ee2.on('event', function(a, b) {
console.log('got propagated event', a, b)
})
ee1.emit('event', 'a', 'b')
You can unpropagate by ending the propagation like this:
const ee1 = new EventEmitter()
const ee2 = new EventEmitter()
const p = propagate(ee1, ee2)
// ...
p.end()
const ee1 = new EventEmitter()
const ee2 = new EventEmitter()
const p = propagate(['event1', 'event2'], ee1, ee2)
const ee1 = new EventEmitter()
const ee2 = new EventEmitter()
const p = propagate(
{
event1: 'other-event1',
event2: 'other-event2',
},
ee1,
ee2
)
MIT