Dead simple event emitter.
npm i emitify --save
What you should do first is create new instance of emitify
with
const emitify = Emitify();
Than you could just use API as it is.
Add callback
listener to event
.
Remove callback
listener from event
.
Emit event
with (or without) data.
Alias to emitter.on
.
Alias to emitter.off
.
Removes all listeners related to event
.
const Emitify = require('emitify');
const emitter = new Emitify();
const log = (data) => {
console.log(data);
});
emitter.on('data', log);
emitter.emit('data', 'hello');
emitter.off('data', log);
MIT