jenesius-event-emitter
v1.0.4
Published
Simple, small and with off-hook.
Downloads
426
Maintainers
Readme
event-emitter
Simple, small and with off-hook.
Global usign
import EventEmitter from "jenesius-event-emitter";
const offMessage = EventEmitter.on('message', m => {});
EventEmitter.emit('message', 'simple');
// If handler not needed:
offMessage();
Extends using
class Test extends EventEmitter {
// ...
}
const test = new Test()
test.on('message', () => {})
test.emit('message');
or
const a = new EventEmitter();
a.on('message', () => {})
a.emit('message');