UNPKG

@bitbybit-dev/occt-worker

Version:

Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel adapted for WebWorker

36 lines (35 loc) 1.76 kB
import { Subject } from "rxjs"; import { OccInfo } from "./occ-info"; import { OCCTWorkerMock } from "./occ-worker-mock"; /** * This is a manager of OpenCascade 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 OCCTWorkerManager { occWorkerState$: Subject<OccInfo>; errorCallback: (err: string) => void; private occWorker; private promisesMade; occWorkerAlreadyInitialised(): boolean; /** * Convert File/Blob to Uint8Array if needed, before sending to worker. * File/Blob objects cannot be cloned for postMessage, so we convert them first. * ArrayBuffer is also converted to Uint8Array for WASM compatibility. */ prepareStepData(data: string | ArrayBuffer | Uint8Array | File | Blob): Promise<string | Uint8Array>; setOccWorker(worker: Worker | OCCTWorkerMock): 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>; }