Publishes a message to a topic. Calls functions subscribed to the topic in the order in which they were added, passing all arguments along.
If this object was created with async=true, subscribed functions are called via setTimeout(). Otherwise, the functions are called directly, and if any of them throw an uncaught error, publishing is aborted.
Topic to publish to.
Rest
...var_args: any[]Arguments that are applied to each subscription function.
Whether any subscriptions were called.
Subscribes a function to a topic. The function is invoked as a method on
the given opt_context
object, or in the global scope if no context
is specified. Subscribing the same function to the same topic multiple
times will result in multiple function invocations while publishing.
Returns a subscription key that can be used to unsubscribe the function from
the topic via #unsubscribeByKey.
Topic to subscribe to.
Function to be invoked when a message is published to the given topic.
Object in whose context the function is to be called (the global scope if none).
Subscription key.
Subscribes a single-use function to a topic. The function is invoked as a
method on the given opt_context
object, or in the global scope if
no context is specified, and is then unsubscribed. Returns a subscription
key that can be used to unsubscribe the function from the topic via
#unsubscribeByKey.
Topic to subscribe to.
Function to be invoked once and then unsubscribed when a message is published to the given topic.
Object in whose context the function is to be called (the global scope if none).
Subscription key.
Unsubscribes a function from a topic. Only deletes the first match found. Returns a Boolean indicating whether a subscription was removed.
Topic to unsubscribe from.
Function to unsubscribe.
Object in whose context the function was to be called (the global scope if none).
Whether a matching subscription was removed.
Removes a subscription based on the key returned by #subscribe. No-op if no matching subscription is found. Returns a Boolean indicating whether a subscription was removed.
Subscription key.
Whether a matching subscription was removed.
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.