0.0.1 • Published 8 years ago
pubsubz v0.0.1
pubSubz
Simple pubsub implementation.
Installation
Using npm:
$ npm i --save pubsubz
Using cdn:
<script src="https://cdn.rawgit.com/tidupls/pubsubz/master/dist/pubsubz.min.js"></script>
Using bower:
$ bower install pubsubz
Example
function handler() {
console.log('Well hello there!');
}
// Subscribing to event:
pubSubz.subscribe('greet', handler);
// Can then publish
pubSubz.publish('greet'); // logs "Well hello there!"
// And remove if needed
pubSubz.unsubscribe('greet', handler);
API
pubSubz.subcribe(eventName, functionToInvoke)
pubSubz.publish(EventToPublishTo, argsToPassToFunction)
pubSubz.unsubscribe(eventName, functionToRemove)
0.0.1
8 years ago