UNPKG

@player-ui/player

Version:

44 lines 1.68 kB
import { SyncHook, SyncWaterfallHook } from "tapable-ts"; import type { View, NavigationFlowViewState } from "@player-ui/types"; import type { Resolve } from "../../view"; import { ViewInstance } from "../../view"; import type { Logger } from "../../logger"; import type { FlowController } from "../flow"; import type { DataController } from "../data/controller"; import type { TransformRegistry } from "./types"; export interface ViewControllerOptions { /** Where to get data from */ model: DataController; /** Where to log data */ logger?: Logger; /** A flow-controller instance to listen for view changes */ flowController: FlowController; } export type ViewControllerHooks = { /** Do any processing before the `View` instance is created */ resolveView: SyncWaterfallHook<[ View | undefined, string, NavigationFlowViewState ]>; /** The hook right before the View starts resolving. Attach anything custom here */ view: SyncHook<[ViewInstance]>; }; /** A controller to manage updating/switching views */ export declare class ViewController { readonly hooks: ViewControllerHooks; private readonly viewMap; private readonly viewOptions; private pendingUpdate?; private readonly viewPlugins; currentView?: ViewInstance; transformRegistry: TransformRegistry; optimizeUpdates: boolean; constructor(initialViews: View[], options: Resolve.ResolverOptions & ViewControllerOptions); private queueUpdate; private getViewForRef; onView(state: NavigationFlowViewState): void; private applyViewPlugins; private createViewPlugins; } //# sourceMappingURL=controller.d.ts.map