UMD PubSub Implementation
This package provides a framework-agnostic PubSub implementation and contains the following API:
register(eventName, functionHandler, executionContext)
isAlreadyRegistered(listener)
remove(eventName)
fire(eventName)
Install the module with: npm install message-bus
var messageBus = require('message-bus');
var users = [];
function User (arg) {
// some constructor code here
}
messageBus.register('login', function(credentials){
this.push(new User(credentials))
}, users);
function login(credentials) {
messageBus.fire('login', credentials);
}
Copyright (c) 2014 Christian H. Schulz
Licensed under the MIT license.