UNPKG

@rxap/life-cycle

Version:

Provides an Angular service and guard to manage application lifecycle. It allows to execute code when the application is stable and ready. Includes a guard to prevent route activation until the app is ready.

17 lines (16 loc) 735 B
import { ApplicationRef } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import * as i0 from "@angular/core"; export interface LifeCycleHook { promise: PromiseLike<any>; } export declare class LifeCycleService { readonly appRef: ApplicationRef; private static hooks; isReady$: BehaviorSubject<boolean>; constructor(appRef: ApplicationRef); static AddHook(name: string, promise: PromiseLike<any>): void; whenReady<T>(thenOrFunction: Observable<T> | PromiseLike<T> | (() => Observable<T>) | (() => PromiseLike<T>) | (() => T)): Observable<T>; static ɵfac: i0.ɵɵFactoryDeclaration<LifeCycleService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<LifeCycleService>; }