Base events
Provides easy way to subscribe and emit events. Super light component
npm install --save base-events
How to use
; const events = ; events; events; events;events; events; // will not emit x.y.z for second time const off = events; ; // unsubscribe listener
Extends
; { super; } { // ... this; } const manager = ; manager;
Available methods
on(event, callback)
- subscribe for event. Returns unsubscribe functiononce(event, callback)
- subscribe for event. Will be emitted only one timeemit(event, arguments)
- trigger event with provided arguments
Community
You are always welcome for ideas and pull requests :)
TODO
- Event keys as patterns. If you are interested in this - please comment here https://github.com/tuchk4/base-events/issues/1
const events = ; events;events;events;events; events; // available listeners: aevents; // available listeners: a.* / a.b.c / a.*.cevents; // available listeners: a.*.c events; // no listenersevents; // available listeners: a