Skip to content

KoryNunn/function-emitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

an event-emitter-like prototype for functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published