vanilla-pubsub
v1.1.2
Published
A JS pub/sub implementation
Downloads
141
Readme
PubSub - vanilla-pubsub
PubSub is a JS implementation of a publication/subscription pattern in JS using vanilla JS.
Install
npm install --save vanilla-pubsub
Usage
Subscribe
PubSub.subscribe('App.loaded', function () {});
PubSub.subscribe('App.done', [App.loadStack, App.clock]);
PubSub.subscribe(['App.undo', 'App.redo'], App.change);
Unsubscribe
PubSub.unsubscribe('App.done', App.loadStack);
PubSub.unsubscribe(['App.undo', 'App.redo'], App.change);
Publish
PubSub.publish('App.loaded');
PubSub.publish('App.loaded', { data: App.data });
PubSub.publish(['App.undo', 'App.redo']);