1.0.0 • Published 8 years ago

function-emitter v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

function-emitter

A tiny prototype to set on a funciton to make it work as an event emitter.

Usage

var functionEmitter = require('function-emitter');

var doThing = function(a,b){
    return a + b;
};

Object.setPrototypeOf(doThing, functionEmitter);

doThing(2, 4); // -> 6

doThing.on('foo', function(foo){

});

doThing.emit('foo', 'bar'); // Handled above.