onfire.js
nano version (~ 500b) for event-emitter.
Install
npm i --save onfire.js
Usage
; const ee = ; ee; ee; ee; ee;
API
Simple and similar with event-emitter
.
on(eventName: string, callback: Function)
: listen an event.once(eventName: string, callback: Function)
: listen a event only once.fire(eventName: string, ...parameters: any[])
: emit / trigger an event with parameters.off(eventName?: string, callback?: Function)
: unsubscribe an event.
Used
- Events subscribe and dispatcher.
Cross-component communication
for React / Vue / Angular.- System event mechanism.
License
MIT@hustcc.