pubsub

Classes

goog.pubsub.PubSub
Topic-based publish/subscribe channel. Maintains a map of topics to subscriptions. When a message is published to a topic, all functions subscribed to that topic are invoked in the order they were added. Uncaught errors abort publishing. Topics may be identified by any nonempty string, except strings corresponding to native Object properties, e.g. "constructor", "toString", "hasOwnProperty", etc.
goog.pubsub.TopicId
A templated class that is used to register goog.pubsub.PubSub subscribers. Typical usage for a publisher: /** @type {!goog.pubsub.TopicId.} zorg.TopicId.STATE_CHANGE = new goog.pubsub.TopicId( goog.events.getUniqueId('state-change')); // Compiler enforces that these types are correct. pubSub.publish(zorg.TopicId.STATE_CHANGE, zorg.State.STARTED); Typical usage for a subscriber: // Compiler enforces the callback parameter type. pubSub.subscribe(zorg.TopicId.STATE_CHANGE, function(state) { if (state == zorg.State.STARTED) { // Handle STARTED state. } });
goog.pubsub.TypedPubSub
This object is a temporary shim that provides goog.pubsub.TopicId support for goog.pubsub.PubSub. See b/12477087 for more info.

Public Protected Private

Global Properties

goog.pubsub.PubSubTest :
No description.
Code »
goog.pubsub.TypedPubSubTest :
No description.
Code »

Package pubsub

Package Reference