make-object-an-emitter

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i make-object-an-emitter

Weekly Downloads

10

Version

1.0.1

License

MIT

Last publish

Collaborators

  • artskydj