A Simple PubSub Framework, working locally, with regexp feature.
This module has been developed with the wish to provide a simple local pubsub system, providing a simple and easy-to-use API.
Install it either by cloning this repo, or via npm ;-)
var PubSub = require'simplepubsub';var pubsub = ;varconsole.log'Message received on ' + channel + ': ' + JSONstringifyargs;// I do not want to receive those messages anymore!pubsubunsubscribechannel;;var regexp = 'channel.*' 'g';pubsubsubscribe'channel1' 'channel2' 'channel3' onPublish;pubsubregexpSubscriberegexp onPublish;// Stop listening to the regexp after 2 secondssetTimeoutpubsubregexpUnsubscriberegexp;2000;
Check out the JSDoc (JSDox) in the doc directory.