npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bubpubsub

v0.10.0

Published

a pubsub system with bubbling, replies and persistence

Downloads

4

Readme

bubPubSub

bubPubSub (VisualWeb's PubSub) is a publish/subscribe system for communication between objects/modules of your code. It's rather similar to common pubSub systems, but closer related to the event system of nodeJS or the browser. USP's are

  • (optional) BUBBLING along a topic-tree

  • (optional) PERSISTENCE of publications for later retrieval/reference

It is developed, used and sponsored by myLinkCloud (http://www.mylinkcloud.com), meinUnterricht (http://www.meinUnterricht.de), K.lab (http://www.klab-berlin.com), and ViSERiON (http://www.viserion.com) .

compatibility

bubPubSub works on both ends, the client and the server (nodeJS).

Installation with nodeJS

  $ npm install bubpubsub

Test (server-side)

cd to node_modules/bubpubsub
make

VERSION HISTORY:

- v0.8.7 22.11.12
	- introduced silent option as a per-publication flag to avoice console logging
- v0.8.6 22.11.12
	- bugFix
- v0.8.6 22.11.12
	- bugFix
- v0.8.5 19.11.12
	- bugFixes ..
- v0.8.4 15.11.12
	- bugFixes ..
	- old parameters for subscribe will be deprecated announcement
- v0.8.3 15.11.12
	- introduced autoUnsubscribe to subscribe options ! 
	- optional try-catch around subscribers
	- scope setting for subscribers
	- introduced limits for error and publication logs to 10000 items in order to limit memory usage.
- v0.82 28.07.2012
	- bugfix in chain default and if check. 
- v0.81 27.07.12
	- unsubscribe updated to do a better job of namespace (& memory) cleanup
- v0.80 22.06.12
	- added the option to do chaining. this needs quite some field-testing ;)
	- added chainDelay config setting for chained publications to allow breathing-time for the cpu 
- v0.71 15.06.12
	- made the code a bit more beautiful
	- introduced forceUniqueSubscriber to allow replacing subscriber methods by Id
	- replaced isFunction method by typeof test 
	- removed randomString method
	- switched from bad style == to good style === operators... 
	- changed licence
- v0.70 21.03.12
	- renamed
	- fused client (jQuery) and server (nodeJS) versions
	- series of bugfixes
- v0.60	29.10.11			
	- removed dependencies from jQuery. 
	- enabled using the same file for client- and nodeJS server-side implementation
	- added the reply function explicitely

Usage

there is a detailed description of all functions in the source-code ... 

examples (more in the source JS)

		// SUBSCRIPTION TO a deep branch WITHOUT PICKING UP BUBBLES 
 		var myEuropeSubscription = aBubPubSub.subscribe(
 			'/politics/europe', 
 			function(data, currentBranch, publisher, replyCall, subscriptionIdObject) { 
 				console.log('original publication branch: ' + data.originalTopic);  
				console.log('i subscribed to : ' + currentBranch);  
 				replyCall('I am [' + myEuropeSubscription.id + '] and I am only interested in european politics');
 			}, 
 			{ getBubbles: false } 
 			'myEuropeSubscriber'
 		);
	   
	   // SUBSCRIPTION TO ROOT WITH BUBBLING
	    var myRootSubscription = aBubPubSub.subscribe(
 			'/', 
 			function(data, currentBranch, publisher, replyCall, subscriptionIdObject) { 
 				console.log('original publication branch: ' + data.originalTopic);  
				console.log('i subscribed to : ' + currentBranch);  
 				replyCall('I am [' + myRootSubscription.id + '] and I pick up any publication');
 			}, 
 			{ getBubbles: true } 
 			'myRootSubscriber'
 		);

   		// PUBLISH WITH PERSISTANCE AND BUBBLING
		aBubPubSub.publish(
 			'/politics/europe/germany/pipa', 
 			{ 
 				content: 'this is wonderfool',  
			},
			{ 
				bubble:true, 
				persist:true 
			}, 
			'myTestPublisher1',
			function(replyCallParametersOfYourChoice) {
				console.dir(replyCallParametersOfYourChoice);
				return true;
			}
 		);
		
		// PUBLISH WITH PERSISTANCE AND BUBBLING
		aBubPubSub.publish(
 			'/politics/europe/germany/pipa/legislation', 
 			{ 
 				content: 'this can not be picked up by the nonBubbler or the persistence check (below)',  
			},
			{ 
				bubble:true, 
				persist:false 
			}, 
			'myTestPublisher2',
			function(replyCallParametersOfYourChoice) {
				console.dir(replyCallParametersOfYourChoice);
				return true;
			}
 		);
		
		
		// PERSISTANCE
		var persistentPublicationObjectArrayOnPolitics = aBubPubSub.wasPublishedOnTopic('/politics', true);
	
		// UNSUBSCRIBE
		aBubPubSub.unsubscribe(myRootSubscription);