UNPKG

pandora

Version:
48 lines (47 loc) 1.63 kB
import { AppletRepresentation, ProcessRepresentation, Applet } from '../domain'; import { WorkerContext } from './WorkerContext'; /** * The reconciler of applet * 1. Inject the applets, and manage them * 2. Resolve the applet's config * 3. Instantiate the applet and drive it's lifecycle */ export declare class AppletReconciler { protected processRepresentation: ProcessRepresentation; private appletSet; private instanceMap; private context; /** * @param {ProcessRepresentation} processRepresentation - ProcessRepresentation object * @param {WorkerContext} context - WorkerContext object */ constructor(processRepresentation: ProcessRepresentation, context: WorkerContext); /** * Receive an applet by AppletRepresentation * @param {AppletRepresentation} applet - AppletRepresentation object * @returns {void} */ receiveAppletRepresentation(applet: AppletRepresentation): void; /** * Get an AppletRepresentation object by certain applet's name * @param name - Name of applet * @returns {AppletRepresentation} */ private getRepresentationByAppletName(name); /** * Get an instance of applet * @param {AppletRepresentation | string} represent - AppletRepresentation or applet's name * @return {Applet} */ getAppletInstance<T extends Applet>(represent: AppletRepresentation | string): T; /** * Start all the applets * @return {Promise<void>} */ start(): Promise<void>; /** * Stop all the applets * @return {Promise<void>} */ stop(): Promise<void>; }