Mixspa Events
This is a simple pubsub for mixspa with window custom event. This library only can be used in browser.
Current Status:
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.