import { Subscription, TeardownLogic } from 'rxjs'; import { KeyValue } from '@rxap/utilities'; export declare enum SubscriptionHandlerErrorTypes { NOT_FOUND = "Subscription with specified key not found", CLOSED = "Subscription with specified key is closed" } export declare class SubscriptionHandlerError extends Error { type: SubscriptionHandlerErrorTypes; key: string; constructor(type: SubscriptionHandlerErrorTypes, key: string); } /** * Provide the same functionality as Subscription from rxjs. * With the extation that the subscriptions can be group added/unsubscribed * * @deprecated removed */ export declare class SubscriptionHandler { /** * @internal */ static DEFAULT_KEY: string; /** * A map of subscriptions * * @internal */ readonly subscriptions: Map; /** * Adds a tear down to be called during the unsubscribe() of this * Subscription. Can also be used to add a child subscription. * * If the tear down being added is a subscription that is already * unsubscribed, is the same reference `add` is being called on, or is * `Subscription.EMPTY`, it will not be added. * * If this subscription is already in an `closed` state, the passed * tear down logic will be executed immediately. * * When a parent subscription is unsubscribed, any child subscriptions that were added to it are also unsubscribed. * * @param {TeardownLogic} teardown The additional logic to execute on * teardown. * @return {Subscription} Returns the Subscription used or created to be * added to the inner subscriptions list. This Subscription can be used with * `remove()` to remove the passed teardown logic from the inner subscriptions * list. */ add(teardown: TeardownLogic): Subscription; /** * Adds a tear down to be called during the unsubscribe() of this * Subscription. Can also be used to add a child subscription. * * If the tear down being added is a subscription that is already * unsubscribed, is the same reference `add` is being called on, or is * `Subscription.EMPTY`, it will not be added. * * If this subscription is already in an `closed` state, the passed * tear down logic will be executed immediately. * * When a parent subscription is unsubscribed, any child subscriptions that were added to it are also unsubscribed. * * @param key the subscription group key * @param {TeardownLogic} teardown The additional logic to execute on * teardown. * @return {Subscription} Returns the Subscription used or created to be * added to the inner subscriptions list. This Subscription can be used with * `remove()` to remove the passed teardown logic from the inner subscriptions * list. */ add(key: string, teardown: TeardownLogic): Subscription; has(key: string): boolean; get(key: string): Subscription | undefined; set(key: string, teardown: TeardownLogic): Subscription; /** * Disposes the resources held by the subscription. May, for instance, cancel * an ongoing Observable execution or cancel any other type of work that * started when the Subscription was created. * * @param key (optional) the target group of subscriptions */ unsubscribe(key?: string): Subscription; /** * Disposes all the resources held by the subscription handler. May, for instance, cancel * an ongoing Observable execution or cancel any other type of work that * started when the Subscription was created. */ unsubscribeAll(): KeyValue; /** * Resets the specified subscription group. * Each Subscription in the group will be unsubscribed before the new subscription * instance is created * * @param key (optional) the target group of subscriptions */ reset(key?: string): void; resetAll(): void; }