Another typescript bus event.
Why not.
npm i laguagua --save
import { laGuaGua as bus } from 'laguagua';
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 an event message.
bus.publish('bus::stop');
Subscribe into an event message.
const eventHandler = (message, data) => console.log(message);
bus.subscribe('bus::stop', eventHandler);
Clear all bus subscriptions.
bus.clear();