Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
45 lines (31 sloc) 1.01 KB


Siphon multiple event listeners to a single function.

Build Status


Works with Express 3.0.x

$ npm install siphon


Siphon will add a one time listener to each emitter in the emitter array

// require it
var siphon = require('siphon'),
    EventEmitter = require('events').EventEmitter
    emitter1 = new EventEmitter(),
    emitter2 = new EventEmitter();

// siphon an event
siphon('init', [emitter1, emitter2], function (emitter1Args, emitter2Args) {
  console.log('Both emitters have fired!');
  console.log(emitter1Args[0] === emitter1);
  console.log(emitter2Args[0] === emitter2);

// Fire the events
console.log('Firing emitter 1');
emitter1.emit('init', emitter1);
console.log('Firing emitter 2');
emitter2.emit('init', emitter2);


siphon(eventName, emitters, callback)

  • @param {String} eventName
  • @param {Array} emitters
  • @param {Function} callback
Something went wrong with that request. Please try again.