@mixspa/events

A events library for mixspa to implement pub sub


Keywords
lib, node, babel, jest, eslint, security, circleci
License
MIT
Install
npm install @mixspa/events@0.3.0

Documentation

Mixspa Events

This is a simple pubsub for mixspa with window custom event. This library only can be used in browser.

Current Status:

NPM Version NPM Downloads Build Status

NPM

How to use?

import MixspaEvent from 'mixspa-events'
/*
MixspaEvent.on('[namespace]:[module]:[action]': String, callback: Function) : Listener;
*/
let listener = MixspaEvent.on('mixspa:test:update', (message) => {
  console.log(message);
});

/*
MixspaEvent.emit('[namespace]:[module]:[action]': String, message: Object);
*/
MixspaEvent.emit('mixspa:test:update', 'Hello Test');

/*
MixspaEvent.off('[namespace]:[module]:[action]': String, listener: Object);
*/
MixspaEvent.off('mixspa:test:update', listener);

License

mixspa-events is released under the MIT license.