export declare class EventService {
    /**
     * Send the given payload to subscribers of the given topic.
     * @param topic See [subscribe](EventService#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;
    /**
     * Removes a subscription.
     * 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.
     */
    static unsubscribe(key: EventSubscriptionKey): void;
    /**
     * 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(topics, callback);
}
/**
 * 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
     */
    unsubscribe(): void;
}
export declare type EventSubscriptionCallback = (topic: string, payload: any) => any;
export declare type EventSubscriptionKey = string | EventSubscriptionCallback;
export interface IEventSubscription {
    unsubscribe(): void;
}
export declare class EventSubscription implements IEventSubscription {
    private key;
    constructor(key: EventSubscriptionKey);
    unsubscribe(): void;
}
