raptor-pubsub
Super lightweight module to support EventEmitter-based Pub/Sub communication in the browser and on the server.
Installation
npm install raptor-pubsub --save
Usage
Communicating on the global pub/sub channel
var raptorPubsub = require('raptor-pubsub');
raptorPubsub.on('someEvent', function(arg) {
});
raptorPubsub.emit('someEvent', 'Hello World');
Communicating on named pub/sub channels
var channel = require('raptor-pubsub').channel('my-channel');
channel.on('someEvent', function(arg) {
});
channel.emit('someEvent', 'Hello World');
require('raptor-pubsub').removeChannel('my-channel');
The global pub/sub channel and named channels are simply EventEmitter instances.
Contributors
Contribute
Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.
License
Apache License v2.0