raptor-pubsub

Support for Pub/Sub communication in the browser

Showing:

Popularity

Downloads/wk

657

GitHub Stars

6

Maintenance

Last Commit

7yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

0.3KB

License

Apache-2.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

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

Contribute

Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.

License

Apache License v2.0

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100