Skip to content
This repository has been archived by the owner on Mar 5, 2019. It is now read-only.
/ js-eventbus Public archive

Simple library to trigger custom events

License

Notifications You must be signed in to change notification settings

DVS-devtools/js-eventbus

Repository files navigation

js-eventbus

[!!!] The source code of this package is on https://github.com/docomodigital/js-utils, this repository will be removed asap

Build Status Coverage Status npm version Greenkeeper badge

Simple library to trigger custom events

Usage

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')

Installation

NPM

npm install --save js-eventbus

Documentation

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