event-relay

A little module for proxying events through arbitrary emitters.

event-relay

event-relay is a little module for proxying events through arbitrary emitters. It will work with any event emitter implementation (EventEmitter, emitter-component, asEvented, etc) that exposes an emit() method.

$ npm install event-relay
event-relay(
 
  event (string):
    the name of the event that
    will be emitted
 
  emitter (event_emitter):
    the proxy who will emit the
    aforementioned event. must 
    have an emit() method
 
)
var EventEmitter = require('events').EventEmitter
var relay = require('event-relay')
 
var source = new EventEmitter
var proxy = new EventEmitter
 
proxy.on('relayed-event', function(data) {
  // { some: 'data' } 
})
 
source.on('event', relay('relayed-event', proxy))
source.emit('event', { some: 'data' })

MIT