/**
 * A Pub/Sub event system that enables you to subscribe to various events published by Arc.js.
 * For more information, see [Pub/Sub Events](/Events.md#pubsubevents).
 */
export declare class PubSubEventService {
    /**
     * Send the given payload to subscribers of the given topic.
     * @param topic See [subscribe](PubSubEventService.md#subscribe)
     * @param payload Sent in the subscription callback.
     * @returns True if there are any subscribers
     */
    static publish(topic: string, payload: any): boolean;
    /**
     * Subscribe to the given topic or array of topics.
     * @param topics Identifies the event(s) to which you wish to subscribe
     * @param callback The function to call when the requested events are published
     * @returns An interface with `.unsubscribe()`.  Be sure to call it!
     */
    static subscribe(topics: string | Array<string>, callback: EventSubscriptionCallback): IEventSubscription;
    /**
     * Remove all subscriptions
     */
    static clearAllSubscriptions(): void;
    /**
     * Unsubscribes after optional timeout.
     * When passed a token, removes a specific subscription,
     * when passed a callback, removes all subscriptions for that callback,
     * when passed a topic, removes all subscriptions for the topic hierarchy.
     *
     * @param key - A token, function or topic to unsubscribe.
     * @param milliseconds number of milliseconds to timeout.
     * Default is -1 which means not to timeout at all.
     */
    static unsubscribe(key: EventSubscriptionKey, milliseconds?: number): Promise<void>;
    /**
     * Return whether topic is specified by matchTemplates.
     *
     * Examples:
     *
     * matchTemplates: ["foo"]
     * topic: "foo.bar"
     * result: true
     *
     * matchTemplates: ["foo.bar"]
     * topic: "foo"
     * result: false
     *
     * Or a wildcard:
     *
     * matchTemplates: "*"
     * topic: "foo"
     * result: true
     *
     * @param matchTemplates
     * @param topic
     */
    static isTopicSpecifiedBy(matchTemplates: Array<string> | string, topic: string): boolean;
    /**
     * Subscribe to multiple topics with the single given callback.
     * @param topics topic or collection of topics
     * @param callback Callback to handle them all
     * @returns An interface with `.unsubscribe()`.  Be sure to call it!
     */
    private static aggregate;
}
/**
 * Creates a collection of subscriptions to which one can unsubscribe all at once.
 */
export declare class SubscriptionCollection implements IEventSubscription {
    /**
     * Collection of values returned by `subscribe`, or the token, or the handler function
     */
    private subscriptions;
    constructor(topics?: string | Array<string>, callback?: EventSubscriptionCallback);
    /**
     * Subscribe a single callback to a set of events
     * @param topics
     * @param callback
     */
    subscribe(topics: string | Array<string>, callback: EventSubscriptionCallback): void;
    /**
     * Unsubscribe from all of the events
     * @param milliseconds number of milliseconds to timeout.
     * Default is -1 which means not to timeout at all.
     */
    unsubscribe(milliseconds?: number): Promise<void>;
}
export declare type EventSubscriptionCallback = (topic: string, payload: any) => any;
export declare type EventSubscriptionKey = string | EventSubscriptionCallback;
export interface IEventSubscription {
    unsubscribe(milliseconds?: number): Promise<void>;
}
export declare class EventSubscription implements IEventSubscription {
    private key;
    constructor(key: EventSubscriptionKey);
    /**
     * Unsubscribes after optional timeout.
     * @param milliseconds number of milliseconds to timeout.
     * Default is -1 which means not to timeout at all.
     */
    unsubscribe(milliseconds?: number): Promise<void>;
}
