0.0.1 • Published 8 years ago

pubsubz v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

pubSubz


Travis build status Code Climate Test Coverage Dependency Status devDependency Status

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)