You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sigonasr2
8202feb6cb
|
4 years ago | |
---|---|---|
.. | ||
tests | 4 years ago | |
.eslintignore | 4 years ago | |
.eslintrc.yml | 4 years ago | |
.prettierignore | 4 years ago | |
.prettierrc.yml | 4 years ago | |
.travis.yml | 4 years ago | |
LICENSE.md | 4 years ago | |
README.md | 4 years ago | |
index.js | 4 years ago | |
package.json | 4 years ago |
README.md
propagate
Propagate events from one event emitter into another.
Install
$ npm install propagate
Propagate
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
propagate(ee1, ee2)
ee2.on('event', function(a, b) {
console.log('got propagated event', a, b)
})
ee1.emit('event', 'a', 'b')
Unpropagate
You can unpropagate by ending the propagation like this:
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
var p = propagate(ee1, ee2)
// ...
p.end()
Only propagate certain events:
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
var p = propagate(['event1', 'event2'], ee1, ee2)
Propagate certain events as other events:
var ee1 = new EventEmitter()
var ee2 = new EventEmitter()
var p = propagate(
{
event1: 'other-event1',
event2: 'other-event2',
},
ee1,
ee2
)
License
MIT