UNPKG

@wizdm/teleport

Version:
26 lines (25 loc) 1 kB
import { TemplateRef, InjectionToken } from '@angular/core'; import { Observable } from 'rxjs'; export declare const TeleportConfigToken: InjectionToken<TeleportConfig>; export interface TeleportConfig { bufferSize?: number; } export interface TeleportPayload { action: 'activate' | 'clear' | 'clearAll'; template?: TemplateRef<Object | null>; target?: string; data?: any; } export declare class TeleportService { private inner$; readonly beam$: Observable<TeleportPayload>; constructor(config: TeleportConfig); /** Beam observable streaming the template to render as they occur */ beam(name: string): Observable<TeleportPayload>; /** Activates the template at the given target portal */ activate(target: string, template: TemplateRef<Object | null>, data?: any): void; /** Clears the template from the target portal */ clear(target: string, template: TemplateRef<Object | null>): void; /** Clear all the portals */ clearAll(): void; }