/** * Worker utilities for bitbybit engine packages. * * Provides multiple strategies for creating workers: * 1. From CDN URLs (zero configuration, no local files needed) * 2. From local project files (for offline/production use) */ /** * Worker architecture type for CDN workers. - "32" - 32-bit WebAssembly (default, widest browser support) - * "64-bit" - 64-bit WebAssembly (better performance, requires browser support for Memory64) - "64-bit-mt" - * 64-bit multithreaded WebAssembly (best performance, requires SharedArrayBuffer and Memory64) */ export type WorkerArchitecture = "32" | "64" | "64-mt"; /** * Worker configuration containing the Worker instance or undefined */ export interface WorkerInstances { occtWorker?: Worker | undefined; jscadWorker?: Worker | undefined; manifoldWorker?: Worker | undefined; } /** * Options for worker creation */ export interface WorkerOptions { /** Enable OCCT (OpenCASCADE) kernel */ enableOCCT?: boolean | undefined; /** Enable JSCAD kernel */ enableJSCAD?: boolean | undefined; /** Enable Manifold kernel */ enableManifold?: boolean | undefined; /** Custom CDN URL (defaults to GlobalCDNProvider.BITBYBIT_CDN_URL) */ cdnUrl?: string | undefined; /** * Array of font keys to load for OCCT, or undefined to load all fonts. * Pass an empty array to skip loading fonts. */ loadFonts?: string[] | undefined; /** * OCCT worker architecture to use. Defaults to "32" (32-bit). Note: This only applies to OCCT workers. * JSCAD and Manifold always use 32-bit. - "32" - 32-bit WebAssembly (default, widest browser support) - * "64" - 64-bit WebAssembly (better performance, requires browser support for Memory64) - "64-mt" - * 64-bit multithreaded WebAssembly (best performance, requires SharedArrayBuffer and Memory64) */ occtArchitecture?: WorkerArchitecture | undefined; } /** * Creates an OCCT worker from CDN. * No local files needed - worker is loaded directly from CDN. * * @param cdnUrl - Optional custom CDN URL * @param loadFonts - Array of font keys to load, or undefined to load all fonts. Empty array skips font loading. * @param architecture - Worker architecture: "32" (default), "64", or "64-mt" */ export declare function createOcctWorkerFromCDN(cdnUrl?: string, loadFonts?: string[], architecture?: WorkerArchitecture): Worker; /** * Creates a JSCAD worker from CDN. * No local files needed - worker is loaded from CDN. * Note: JSCAD only supports 32-bit architecture. * * @param cdnUrl - Optional custom CDN URL */ export declare function createJscadWorkerFromCDN(cdnUrl?: string): Worker; /** * Creates a Manifold worker from CDN. * No local files needed - worker is loaded from CDN. * Note: Manifold only supports 32-bit architecture. * * @param cdnUrl - Optional custom CDN URL */ export declare function createManifoldWorkerFromCDN(cdnUrl?: string): Worker; /** * Creates all enabled worker instances from CDN. * This is the simplest way to get started - no local files needed! * * @example * ```typescript * // Default 32-bit workers * const workers = createWorkersFromCDN({ enableOCCT: true, enableJSCAD: true }); * * // 64-bit OCCT worker for better performance (JSCAD/Manifold remain 32-bit) * const workers64 = createWorkersFromCDN({ enableOCCT: true, occtArchitecture: "64" }); * * // 64-bit multithreaded OCCT worker for best performance * const workersMT = createWorkersFromCDN({ enableOCCT: true, occtArchitecture: "64-mt" }); * ``` */ export declare function createWorkersFromCDN(options: WorkerOptions): WorkerInstances; /** * Creates workers from local project files (ES module workers). * Use this when you have worker files in your project for offline/production use. * * @param workerUrls - URLs to your local worker files * * @example * ```typescript * const workers = createWorkersFromUrls({ * occtWorkerUrl: new URL("./workers/occt.worker.ts", import.meta.url), * jscadWorkerUrl: new URL("./workers/jscad.worker.ts", import.meta.url), * }); * ``` */ export declare function createWorkersFromUrls(workerUrls: { occtWorkerUrl?: URL | string | undefined; jscadWorkerUrl?: URL | string | undefined; manifoldWorkerUrl?: URL | string | undefined; }): WorkerInstances;