modapp-eventbus
v1.8.2
Published
EventBus used for implementing modapp's Model interface, Collection interface, and LocaleString interface.
Downloads
5,536
Readme
ModApp EventBus
EventBus used for implementing modapp's Model interface, Collection interface, and LocaleString interface.
Installation
With npm:
npm install modapp-eventbus --save
With yarn:
yarn add modapp-eventbus
Usage
import eventBus from 'modapp-eventbus';
let callback = data => {
console.log("data");
};
// Add event listener
eventBus.on('client.disconnect', cb);
// Emit an event
eventBus.emit('client.disconnect', /* data */ { foo: "bar" });
// Remove event listener
eventBus.off('client.disconnect', cb);