Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Simple Message Hub for use as a global PubSub/Mediator.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
test
LICENSE
README.md

README.md

Message Hub

This is a little message hub/mediator that is useful to perform global "PubSub".

Use

Include src/hub.js into your project.

Listen for a specific message.

// callback is invoked any time `message` is fired.
// handle is used to turn off the listener.
var handle = Hub.on(`message`, `callback`, [`context`]);

Listen for any message.

// callback is invoked any time any message is fired.
// handle is used to turn off the listener.
var handle = Hub.all(`callback`, [`context`]);

Fire a message.

Hub.fire(`message`, [`arg1`], [`arg2`], ..., [`argN`]);

Remove a listener.

Hub.off(`handle`);

Resetting the entire hub.

Hub.reset();

License

Available under the Mozilla "Tri-License" - MPL 1.1, GPL 2.0, or LGPL 2.1.

Original Code

Original code found at https://github.com/stomlinson/message_hub

Author Info

Something went wrong with that request. Please try again.