UNPKG

@bitbybit-dev/occt-worker

Version:

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

39 lines (38 loc) 1.48 kB
import type { BitbybitOcctModule } from "@bitbybit-dev/occt/bitbybit-dev-occt/bitbybit-dev-occt"; import { CacheHelper } from "./cache-helper"; /** * Input structure for worker messages. */ export type DataInput = { /** * Action data containing the function to call and its inputs. * The inputs are hashed for caching purposes. */ action: { functionName: string; inputs: Record<string, unknown>; }; /** * Unique identifier used to match responses with their corresponding requests. */ uid: string; }; /** * Initializes the OpenCascade worker with the given module and plugins. * * @param occ - The BitbybitOcctModule instance * @param plugins - Optional plugins to add to the OpenCascade service (e.g., AdvancedOCCT) * @param doNotPost - If true, skip posting the initialization message (used for testing) * @returns The CacheHelper instance for testing purposes */ export declare const initializationComplete: (occ: BitbybitOcctModule, plugins: any, doNotPost?: boolean) => CacheHelper; /** * Main message handler for the OCCT worker. * * Processes incoming messages from the main thread, executes the requested * OCCT operations, and sends results back. * * @param d - The data input containing the action to perform * @param postMessage - Function to send messages back to the main thread */ export declare const onMessageInput: (d: DataInput, postMessage: (message: unknown) => void) => void;