cemitter
v1.0.1
Published
Super tiny, closure-based event emitter.
Downloads
1
Readme
cemitter
Super tiny, closure-based event emitter.
Installation
npm install cemitter
Usage
const cemitter = require('cemitter')
const emitter = cemitter()
emitter.on('test', (data) => {
console.log(data) // => { foo: "bar" }
})
emitter('test', { foo: 'bar' })
API
emitter = cemitter()
Initialize an emitter.
emitter.on(event, callback([...data]))
Register an event with the given callback.
emitter(event[, ...data])
Trigger an event and execute the corresponding callback with the given data.
Aliased to emitter.on
.