https://github.com/feross/re-emitter
Re emit events from another emitter
https://github.com/feross/re-emitter
emitter javascript nodejs re-emit reemit
Last synced: 10 months ago
JSON representation
Re emit events from another emitter
- Host: GitHub
- URL: https://github.com/feross/re-emitter
- Owner: feross
- License: mit
- Created: 2012-08-28T03:26:11.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2020-10-29T05:01:09.000Z (over 5 years ago)
- Last Synced: 2025-01-03T02:53:09.839Z (over 1 year ago)
- Topics: emitter, javascript, nodejs, re-emit, reemit
- Language: JavaScript
- Size: 30.3 KB
- Stars: 18
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# re-emitter [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/re-emitter/master.svg
[travis-url]: https://travis-ci.org/feross/re-emitter
[npm-image]: https://img.shields.io/npm/v/re-emitter.svg
[npm-url]: https://npmjs.org/package/re-emitter
[downloads-image]: https://img.shields.io/npm/dm/re-emitter.svg
[downloads-url]: https://npmjs.org/package/re-emitter
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Re emit events from another emitter

[](https://saucelabs.com/u/magnet-uri)
Works in node and the browser with [browserify](http://browserify.org/).
[](https://github.com/feross/standard)
### install
```
npm install re-emitter
```
### usage
```js
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.