UNPKG

@bitbybit-dev/jscad-worker

Version:

Bit By Bit Developers JSCAD Based CAD Library to Program Geometry Via WebWorker

30 lines (29 loc) 1.42 kB
import { Subject } from "rxjs"; import { JscadInfo } from "./jscad-info"; import { JSCADWorkerMock } from "./jscad-worker-mock"; /** * This is a manager of JSCAD worker. Promisified API allows to deal with the worker in a more natural way * and because all those CAD algorithms are quite heavy this does make a lot of sense at this time. */ export declare class JSCADWorkerManager { jscadWorkerState$: Subject<JscadInfo>; errorCallback: (err: string) => void; private jscadWorker; private promisesMade; jscadWorkerAlreadyInitialised(): boolean; setJscadWorker(worker: Worker | JSCADWorkerMock): void; cleanPromisesMade(): void; genericCallToWorkerPromise(functionName: string, inputs: any): Promise<any>; /** * This needs to be done before every run and the promise needs to be awaited before run executes again * This makes sure that cache keeps the objects and hashes from the previous run and the rest is deleted * In this way it is possible to hace the cache of manageable size */ startedTheRun(): Promise<any>; /** * This needs to be done before every run and the promise needs to be awaited before run executes again * This makes sure that cache keeps the objects and hashes from the previous run and the rest is deleted * In this way it is possible to hace the cache of manageable size */ cleanAllCache(): Promise<any>; }