var window = {}; var WA = WXWebAssembly; var WebAssembly = WA; WebAssembly.RuntimeErrror = Error; var performance = { now: Date.now, }; Module['instantiateWasm'] = (info, receiveInstance) => { console.log("loading wasm...", info); // Use dynamic path from global data if available, otherwise fallback to hardcoded path var wasmPath = "pages/emblemscanner/qrtool.wx.wasm.br"; try { // Check if we're in a WeChat miniprogram environment and have access to getApp if (typeof getApp !== 'undefined') { var app = getApp(); if (app && app.globalData && app.globalData.wasmFilePath) { wasmPath = app.globalData.wasmFilePath; console.log("Using dynamic WASM path:", wasmPath); } } } catch (e) { console.warn("Failed to get dynamic WASM path, using fallback:", e); } WebAssembly.instantiate(wasmPath, info).then((result) => { console.log("result:", result); var inst = result['instance']; receiveInstance(inst); }); }