search

goog.pubsub.TopicId<PAYLOAD>

Provided By

A templated class that is used to register goog.pubsub.PubSub subscribers.

Typical usage for a publisher: /** @type {!goog.pubsub.TopicId<!zorg.State>} 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. } });

new TopicId<PAYLOAD>( topicId )

Parameters
topicIdstring

Instance Methods