1.0.1 • Published 9 years ago

make-object-an-emitter v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

make-object-an-emitter

Turns an object into a node emitter.

Build Status

Example

var makeEmitter = require('make-object-an-emitter')

function myFn () {
	console.log('I am a function...')
}
makeEmitter(myFn)

myFn()
myFn.on('event', function () {
	console.log('...But I am also an event emitter!!!')
})

API

var makeEmitter = require('make-object-an-emitter')

makeEmitter(obj)

makeEmitter mutates obj (an object/function), that will be turned into an event emitter. Existing properties that don't conflict with event emitter properties will be left on the object.

License

MIT