import { Subscription, Subject } from 'rxjs'; export declare type PromiseOrSubscription = Promise | Subscription; export interface AsyncTrackerOptions { activationDelay?: number; minDuration?: number; } export declare class AsyncTracker { /** * An observable that emits true or false as the value for `active` changes */ active$: Subject; /** * @param trackerOptions.activationDelay - number of milliseconds that an added promise needs to be pending before this tracker is active. * @param trackerOptions.minDuration - Minimum number of milliseconds that a tracker will stay active. */ constructor(trackerOptions?: AsyncTrackerOptions); /** * Returns whether this tracker is currently active. That is, whether any of the promises added to/created by this tracker * are still pending. Note: if the `activationDelay` has not elapsed yet, this will return false. */ readonly active: boolean; /** * The count of promises or subscriptions currently being tracked. */ readonly trackingCount: number; /** * Returns whether this tracker is currently tracking a request. * That is, whether any of the promises / subscriptions added to/created by this tracker are still pending. * This method has no regard for `activationDelay`. */ readonly tracking: boolean; /** * Add any arbitrary promise or observable subscription to the tracker. * `tracker.active` will be true until a promise is resolved or rejected or a subscription emits the first value. */ add(promiseOrSubscription: PromiseOrSubscription | PromiseOrSubscription[]): void; /** * Causes a tracker to immediately become inactive and stop tracking all current promises and subscriptions. */ clear(): void; } export declare class AsyncTrackerFactory { create(trackerOptions?: AsyncTrackerOptions): AsyncTracker; }