/// /// /// declare module goog.pubsub { class TypedPubSub extends TypedPubSub__Class { } /** Fake class which should be extended to avoid inheriting static properties */ class TypedPubSub__Class extends goog.Disposable__Class { /** * This object is a temporary shim that provides goog.pubsub.TopicId support * for goog.pubsub.PubSub. See b/12477087 for more info. * @constructor * @extends {goog.Disposable} */ constructor(); /** * See {@code goog.pubsub.PubSub.subscribe}. * @param {!goog.pubsub.TopicId.} topic Topic to subscribe to. * @param {function(this:CONTEXT, PAYLOAD)} fn Function to be invoked when a * message is published to the given topic. * @param {CONTEXT=} opt_context Object in whose context the function is to be * called (the global scope if none). * @return {number} Subscription key. * @template PAYLOAD, CONTEXT */ subscribe(topic: goog.pubsub.TopicId, fn: { (_0: PAYLOAD): any /*missing*/ }, opt_context?: CONTEXT): number; /** * See {@code goog.pubsub.PubSub.subscribeOnce}. * @param {!goog.pubsub.TopicId.} topic Topic to subscribe to. * @param {function(this:CONTEXT, PAYLOAD)} fn Function to be invoked once and * then unsubscribed when a message is published to the given topic. * @param {CONTEXT=} opt_context Object in whose context the function is to be * called (the global scope if none). * @return {number} Subscription key. * @template PAYLOAD, CONTEXT */ subscribeOnce(topic: goog.pubsub.TopicId, fn: { (_0: PAYLOAD): any /*missing*/ }, opt_context?: CONTEXT): number; /** * See {@code goog.pubsub.PubSub.unsubscribe}. * @param {!goog.pubsub.TopicId.} topic Topic to unsubscribe from. * @param {function(this:CONTEXT, PAYLOAD)} fn Function to unsubscribe. * @param {CONTEXT=} opt_context Object in whose context the function was to be * called (the global scope if none). * @return {boolean} Whether a matching subscription was removed. * @template PAYLOAD, CONTEXT */ unsubscribe(topic: goog.pubsub.TopicId, fn: { (_0: PAYLOAD): any /*missing*/ }, opt_context?: CONTEXT): boolean; /** * See {@code goog.pubsub.PubSub.unsubscribeByKey}. * @param {number} key Subscription key. * @return {boolean} Whether a matching subscription was removed. */ unsubscribeByKey(key: number): boolean; /** * See {@code goog.pubsub.PubSub.publish}. * @param {!goog.pubsub.TopicId.} topic Topic to publish to. * @param {PAYLOAD} payload Payload passed to each subscription function. * @return {boolean} Whether any subscriptions were called. * @template PAYLOAD */ publish(topic: goog.pubsub.TopicId, payload: PAYLOAD): boolean; /** * See {@code goog.pubsub.PubSub.clear}. * @param {!goog.pubsub.TopicId.=} opt_topic Topic to clear (all topics * if unspecified). * @template PAYLOAD */ clear(opt_topic?: goog.pubsub.TopicId): void; /** * See {@code goog.pubsub.PubSub.getCount}. * @param {!goog.pubsub.TopicId.=} opt_topic The topic (all topics if * unspecified). * @return {number} Number of subscriptions to the topic. * @template PAYLOAD */ getCount(opt_topic?: goog.pubsub.TopicId): number; } }