re-emitter

1.1.4 • Public • Published

re-emitter travis npm downloads javascript style guide

Re emit events from another emitter

reemit

Sauce Test Status

Works in node and the browser with browserify.

js-standard-style

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.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i re-emitter

    Weekly Downloads

    29,950

    Version

    1.1.4

    License

    MIT

    Unpacked Size

    4.37 kB

    Total Files

    4

    Last publish

    Collaborators

    • feross