UNPKG

@yelon/util

Version:
45 lines (44 loc) 1.21 kB
import { Observable } from 'rxjs'; import * as i0 from "@angular/core"; export interface LazyResult { path: string; status: 'ok' | 'error' | 'loading'; error?: any; } export interface LazyLoadItem { path: string; options?: LazyLoadOptions; } export interface LazyLoadOptions { innerContent?: string; attributes?: Record<string, string>; rel?: string; } /** * `LazyService` delay loading JS or CSS files. * * 延迟加载资源(js 或 css)服务 */ export declare class LazyService { private readonly doc; private list; private cached; private _notify; get change(): Observable<LazyResult[]>; clear(): void; private attachAttributes; /** * Load script or style files */ load(paths: string | LazyLoadItem | Array<string | LazyLoadItem>): Promise<LazyResult[]>; /** * Load a script file */ loadScript(path: string, options?: LazyLoadOptions): Promise<LazyResult>; /** * Load a style file */ loadStyle(path: string, options?: LazyLoadOptions): Promise<LazyResult>; static ɵfac: i0.ɵɵFactoryDeclaration<LazyService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<LazyService>; }