Skip to content
This repository has been archived by the owner on May 28, 2020. It is now read-only.

mixspa/mixspa-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.