Nice Philanthropist Metalhead
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    emitter-proxypublic

    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");
    

    Keywords

    none

    install

    npm i emitter-proxy

    Downloadsweekly downloads

    3

    version

    0.1.0

    license

    none

    last publish

    collaborators

    • avatar