0.2.0 • Published 4 years ago
laguagua v0.2.0

Another typescript bus event.
Activity
Why?
Why not.
Install
npm i laguagua --saveUsage
Import
import { laGuaGua } from 'laguagua';Interface
Review and use to your implementations how the Laguagua interface looks
export interface ILaGuaGua {
publish: (message: string, data?: Object) => void;
subscribe: (message: string, trigger: Handler) => void;
clear: () => void;
}Publish
publish an event message.
bus.publish('bus::stop');Subscribe
Subscribe into an event message.
const eventHandler = (message, data) => console.log(message);
bus.subscribe('bus::stop', eventHandler);Clear
Clear all bus subscriptions.
bus.clear();