[!!!] The source code of this package is on https://github.com/docomodigital/js-utils, this repository will be removed asap
Simple library to trigger custom events
import EventBus from '@docomodigital/js-eventbus';
const Bus = new EventBus();
const callback = (options) => {
console.log(options.foo);
};
Bus.on('customEvent', callback);
Bus.trigger('customEvent', { foo: 'bar' }); // console.log('bar')
npm install --save js-eventbus
To read documentation, go to:
http://docomodigital.github.io/js-eventbus/latest
or run the following command inside the js-eventbus folder:
npm run doc:open