jQuery Pub/Sub plugin code can be found at Gist
jQuery Pub/Sub demo 1: DOM nodes (ASYNC)
In this demo there are 6 jQuery DOM objects (5 black boxes and 1 console box). Click on the boxes to start publishing topics.
- c1 subscribes to c4 and c5 topics.
- c2 subscribes to c3 and c5 topics.
- c3 subscribes to c1 topics. If clicked, c3 subscribes to c4 topics.
- c4 subscribes to c1 and c2 topics. If clicked, c4 unsubscribes from c1 topics.
- c5 subscribes to c3 topics.
- Output console subscribes to all the topics published by the 5 black boxes.
jQuery Pub/Sub demo 2: JS Objects (SYNC)
In this demo there are 2 JS objects (Speaker & Attendant) and 1 jQuery DOM Object (console).
- The output console subscribes to all the topics published by Speaker and Attendant.
jQuery Pub/Sub demo 3: jQuery DOM Objects (2) (ASYNC)
In this demo there are 2 jQuery DOM objects (nodelist of paragraphs & console).
- The output console subscribes to the topic published by paragraphs. This demo tests nodelists support in pub/sub and an alternative way to access the publisher object.