tiny-event-bus-js
v1.0.0 EventBus
EventBus
A simple EventBus tool for JavaScript
API
register(type: string)
Register a new event.
EventBus.register('demaxiya');
remove(type: string)
Remove a registered event.
EventBus.remove('demaxiya');
subscribe(type: string, cb: function)
Subscribe an event.
EventBus.subscribe('demaxiya', func);
cancel(type: string, cb: function)
Cancel subscribing an event, the 'cb' should has been added by 'subscribe'.
EventBus.cancel('demaxiya', func);
publish(type: string, data: any)
Publish en event, you can give a param 'data' to pass some data to the registered 'cb'.
EventBus.publish('demaxiya', { text: 'lalala' });
npm i tiny-event-bus-js
Metadata
- MIT
- Whatever
- alwaysonlinetxm
- released 12/19/2017