re-emitter
![javascript style guide](https://camo.githubusercontent.com/bde227e3207c7143032c0feb73889ffbda8eb1ef234b820b915ccaf74f9c66d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667)
Re emit events from another emitter
Works in node and the browser with browserify.
install
npm install re-emitter
usage
var reemit = require('re-emitter')
var emitter = new EventEmitter()
var other = new EventEmitter()
reemit(emitter, other, ['foo', 'bar'])
other.on('foo', function () {
// foo will fire on other emitter!
})
emitter.emit('foo')
other.on('baz', function () {
// baz will not fire on other emitter
})
emitter.emit('baz')
canceling re-emitting
reemit
returns a function
, which when called, cancels all re-emitting by removing the event listeners which it added.
contributors
- Raynos
- Feross
license
MIT. Copyright (c) Raynos.