import { BehaviorSubject, Subscription, Observable } from "rxjs"; import * as i0 from "@angular/core"; export type Key = string | object | symbol; export interface IGetLoadingOptions { /** Which loading "thing" do you want to track? */ key?: Key; } export interface IAddLoadingOptions { /** Used to track the loading of different things */ key?: Key | Key[]; /** * The first time you call IsLoadingService#add() with * the "unique" option, it's the same as without it. * The second time you call add() with the "unique" option, * the IsLoadingService will see if * an active loading indicator with the same "unique" ID * already exists. * If it does, it will remove that indicator and replace * it with this one (ensuring that calling add() with a * unique key multiple times in a row only adds a single * loading indicator to the stack). Example: * * ```ts * this.isLoadingService.isLoading(); // false * this.isLoadingService.add({ unique: 'test' }); * this.isLoadingService.add({ unique: 'test' }); * this.isLoadingService.isLoading(); // true * this.isLoadingService.remove(); * this.isLoadingService.isLoading(); // false * ``` */ unique?: Key; } export interface IRemoveLoadingOptions { key?: Key | Key[]; } export declare class LoadingService { protected defaultKey: string; errorMessage: any; private loadingSubjects; isSetLoading$: BehaviorSubject; private loadingStacks; private loadingKeyIndex; constructor(); isLoading$(args?: IGetLoadingOptions): Observable; /** * Same as `isLoading$()` except a boolean is returned, * rather than an observable. * * @param args.key optionally specify the key to check */ isLoading(args?: IGetLoadingOptions): boolean; setLoading(observable: Observable, key: any): void; add(): void; add(options: IAddLoadingOptions): void; add | Observable>(sub: T, options?: IAddLoadingOptions): T; remove(a?: Subscription | Promise | IRemoveLoadingOptions, b?: IRemoveLoadingOptions, param?: any): void; private normalizeKeys; private indexKeys; private deIndexKey; private updateLoadingStatus; private _updateLoadingStatus; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }