import MachinatQueue from '../queue'; import type MachinatRenderer from '../renderer'; import type { MachinatNode, NativeComponent, InitScopeFn, DispatchWrapper, MachinatChannel } from '../types'; import { MachinatWorker, DispatchableSegment, DispatchResponse, DispatchFrame } from './types'; /** * MachinatEngine provide helpers to render element tree into tasks to execute, * it pass tasks through dispatch middlewares, execute tasks and return the * results poped through middlewares. */ export default class MachinatEngine, Job, Result> { platform: string; renderer: MachinatRenderer; queue: MachinatQueue; worker: MachinatWorker; private _initScope; private _dispatcher; constructor(platform: string, renderer: MachinatRenderer, queue: MachinatQueue, worker: MachinatWorker, initScope?: InitScopeFn, dispatchWrapper?: DispatchWrapper, Result>); start(): void; stop(): void; /** * render renders machinat element tree into task to be executed. There are * three kinds of task: "dispatch" contains the jobs to be executed on the * certain platform, "pause" represent the interval made by * element which should be waited between "dispatch" tasks, "thunk" holds a * function registered by service which will be excuted after all jobs * dispatched. */ render(target: Target, node: MachinatNode, createJobs: (target: Target, segments: DispatchableSegment[]) => Job[]): Promise>; /** * dispatch construct the dispatch frame containing the tasks along with other * info throught dispatch middleware. At the end of the stack of middlewares, * all the tasks is executed and the response poped up along the retruning * chain of the middlewares. */ dispatchJobs(channel: null | Channel, jobs: Job[]): Promise>; _execute(frame: DispatchFrame): Promise>; }