export declare type Nullable = T | null | undefined; export interface SubscriptionLike { unsubscribe(): void; } /** * Subscription sink that holds Observable subscriptions * until you call unsubscribe on it in ngOnDestroy. */ export declare class SubSink { protected _subs: Nullable[]; /** * Subscription sink that holds Observable subscriptions * until you call unsubscribe on it in ngOnDestroy. * * @example * In Angular: * ``` * private subs = new SubSink(); * ... * this.subs.sink = observable$.subscribe(...) * this.subs.add(observable$.subscribe(...)); * ... * ngOnDestroy() { * this.subs.unsubscribe(); * } * ``` */ constructor(); /** * Add subscriptions to the tracked subscriptions * @example * this.subs.add(observable$.subscribe(...)); */ add(...subscriptions: Nullable[]): void; /** * Assign subscription to this sink to add it to the tracked subscriptions * @example * this.subs.sink = observable$.subscribe(...); */ set sink(subscription: Nullable); /** * Unsubscribe to all subscriptions in ngOnDestroy() * @example * ngOnDestroy() { * this.subs.unsubscribe(); * } */ unsubscribe(): void; }