angular-busy2
Version:
85 lines (77 loc) • 3.42 kB
TypeScript
import * as i0 from '@angular/core';
import { TemplateRef, OnChanges, OnDestroy, Signal, ComponentRef, ViewContainerRef, Renderer2, ElementRef, SimpleChanges, ModuleWithProviders } from '@angular/core';
import { Subscription, Observable } from 'rxjs';
interface CgBusyOptions {
templateRef?: TemplateRef<any>;
message?: string;
wrapperClass?: string;
backdrop?: boolean;
delay?: number;
minDuration?: number;
}
declare class CgBusyDefaults implements CgBusyOptions {
delay: number;
minDuration: number;
backdrop: boolean;
message: string;
wrapperClass: string;
templateRef: TemplateRef<any>;
constructor(busyOptions?: CgBusyOptions);
static ɵfac: i0.ɵɵFactoryDeclaration<CgBusyDefaults, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CgBusyDefaults>;
}
interface TrackerOptions {
minDuration: number;
delay: number;
promises: any[];
}
declare class CgBusyService {
promises: any[];
subscriptions: Subscription[];
delayPromise: number;
durationPromise: number;
minDuration: number;
detectChanges: () => void | null;
private injector;
constructor();
static isPromise(promiseThing: PromiseLike<any>): boolean;
callThen(promiseThing: any, callback: () => void): void;
reset(options: TrackerOptions): void;
createMinDuration(options: TrackerOptions): void;
addPromiseLikeThing(promise: any): void;
active(): boolean;
destroy(): void;
}
declare class CgBusyComponent {
options: CgBusyOptions;
tracker: CgBusyService;
static ɵfac: i0.ɵɵFactoryDeclaration<CgBusyComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CgBusyComponent, "cg-busy", never, { "options": { "alias": "options"; "required": false; }; "tracker": { "alias": "tracker"; "required": false; }; }, {}, never, never, true, never>;
}
declare class CgBusyDirective implements OnChanges, OnDestroy {
private viewContainer;
private defaultOptions;
private renderer;
private el;
cgBusy: boolean | number | Promise<any> | Subscription | Observable<any> | Signal<any> | (Promise<any> | Subscription | Observable<any> | Signal<any>)[];
cgBusyConfig: CgBusyOptions;
tracker: CgBusyService;
fakePromise: Promise<void>;
fakePromiseResolve: () => void;
$options: CgBusyOptions;
$promise: (Promise<any> | Subscription | Observable<any> | Signal<any>)[];
componentRef: ComponentRef<CgBusyComponent>;
constructor(viewContainer: ViewContainerRef, defaultOptions: CgBusyDefaults, renderer: Renderer2, el: ElementRef);
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CgBusyDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CgBusyDirective, "[cgBusy]", ["cgBusy"], { "cgBusy": { "alias": "cgBusy"; "required": false; }; "cgBusyConfig": { "alias": "cgBusyConfig"; "required": false; }; }, {}, never, never, true, never>;
}
declare class CgBusyModule {
static forRoot(busyOptions?: CgBusyOptions): ModuleWithProviders<CgBusyModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<CgBusyModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<CgBusyModule, never, [typeof CgBusyDirective], [typeof CgBusyDirective]>;
static ɵinj: i0.ɵɵInjectorDeclaration<CgBusyModule>;
}
export { CgBusyDefaults, CgBusyDirective, CgBusyModule };
export type { CgBusyOptions };