1.0.5 • Published 11 years ago
raptor-pubsub v1.0.5
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');
// Subscribe to an event
raptorPubsub.on('someEvent', function(arg) {
// Do something...
});
// Publish an event
raptorPubsub.emit('someEvent', 'Hello World');
Communicating on named pub/sub channels
// Get a reference to named pub/sub channel
var channel = require('raptor-pubsub').channel('my-channel');
// Subscribe to an event
channel.on('someEvent', function(arg) {
// Do something...
});
// Publish an event
channel.emit('someEvent', 'Hello World');
// Removing a channel
require('raptor-pubsub').removeChannel('my-channel');
The global pub/sub channel and named channels are simply EventEmitter instances.
Contributors
- Patrick Steele-Idem (Twitter: @psteeleidem)
Contribute
Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.
License
Apache License v2.0
1.0.5
11 years ago
1.0.4
11 years ago
1.0.3
11 years ago
1.0.2
11 years ago
1.0.2-beta
11 years ago
1.0.1-beta
11 years ago
1.0.0-beta
11 years ago
0.2.3-beta
11 years ago
0.2.2-beta
11 years ago
0.2.1-beta
11 years ago
0.2.0-beta
11 years ago