emitter-proxy

0.1.0 • Public • Published

Usage

Browser

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

Example:

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

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

Example:

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i emitter-proxy

      Weekly Downloads

      1

      Version

      0.1.0

      License

      BSD

      Last publish

      Collaborators

      • pvoisin