24 lines
656 B
JavaScript
24 lines
656 B
JavaScript
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 global wasmFilePath (should always be set by the main app)
|
|
var wasmPath = global.wasmFilePath;
|
|
if (!wasmPath) {
|
|
throw new Error("wasmFilePath must be provided via global.wasmFilePath");
|
|
}
|
|
console.log("Using WASM path:", wasmPath);
|
|
|
|
WebAssembly.instantiate(wasmPath, info).then((result) => {
|
|
console.log("result:", result);
|
|
var inst = result['instance'];
|
|
receiveInstance(inst);
|
|
});
|
|
}
|