EventEmitter add-on to allow objects to easily aggregate one instance of EventEmitter and set up chainable proxy methods for it.


Currently you'll need to include EventEmitter on your own and have it exposed as "EventEmitter" in the global scope.


var Clock = function() {
    var emit = EventEmitter.proxy(new EventEmitter(), this).emit;
    var timer = null;
    this.start = function() {
        timer = setInterval(function() { emit("tick"); }, 1000);
    this.stop = function() { clearInterval(timer); };
var clock = new Clock();

NodeJS usage is more elegant as you're simply provided the helper function - put it where you want.


    var EventEmitter = require("events").EventEmitter;
    EventEmitter.proxy = require("emitter-proxy");