@ifc-lite/viewer 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,8 +31,9 @@ let ifcApiInitialized: boolean = false;
31
31
 
32
32
  /**
33
33
  * Initialize IFC-Lite API in worker context
34
+ * The WASM binary is automatically resolved from the same location as the JS module
34
35
  */
35
- async function initIfcApi(wasmPath: string = '/'): Promise<IfcAPI> {
36
+ async function initIfcApi(): Promise<IfcAPI> {
36
37
  if (ifcApi && ifcApiInitialized) {
37
38
  return ifcApi;
38
39
  }
@@ -40,12 +41,8 @@ async function initIfcApi(wasmPath: string = '/'): Promise<IfcAPI> {
40
41
  const initStart = performance.now();
41
42
  console.log('[Worker] Initializing IFC-Lite...');
42
43
 
43
- // Initialize WASM module
44
- const wasmUrl = wasmPath.endsWith('/')
45
- ? `${wasmPath}ifc_lite_wasm_bg.wasm`
46
- : `${wasmPath}/ifc_lite_wasm_bg.wasm`;
47
-
48
- await init(wasmUrl);
44
+ // Initialize WASM module - wasm-bindgen automatically resolves the WASM URL
45
+ await init();
49
46
  ifcApi = new IfcAPI();
50
47
  ifcApiInitialized = true;
51
48
 
@@ -60,11 +57,11 @@ async function initIfcApi(wasmPath: string = '/'): Promise<IfcAPI> {
60
57
  */
61
58
  async function handleMeshCollection(data: { buffer: ArrayBuffer; wasmPath?: string }): Promise<MeshData[]> {
62
59
  const taskStart = performance.now();
63
- const { buffer, wasmPath = '/' } = data;
60
+ const { buffer } = data;
64
61
 
65
62
  // Initialize IFC-Lite if needed
66
63
  const apiInitStart = performance.now();
67
- const api = await initIfcApi(wasmPath);
64
+ const api = await initIfcApi();
68
65
  const apiInitTime = performance.now() - apiInitStart;
69
66
  if (apiInitTime > 10) {
70
67
  console.log(`[Worker] IFC-Lite init took ${apiInitTime.toFixed(2)}ms`);