Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
djones11 committed Jul 25, 2024
1 parent 738a6a0 commit 10c6380
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions dist/opencv.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,50 +806,57 @@
"env": asmLibraryArg,
"wasi_unstable": asmLibraryArg
};

function receiveInstance(instance, module) {
var exports = instance.exports;
Module["asm"] = exports;
removeRunDependency("wasm-instantiate")
removeRunDependency("wasm-instantiate");
}

addRunDependency("wasm-instantiate");

function receiveInstantiatedSource(output) {
receiveInstance(output["instance"])
receiveInstance(output["instance"]);
}

function instantiateArrayBuffer(receiver) {
return getBinaryPromise().then(function (binary) {
return WebAssembly.instantiate(binary, info)
return WebAssembly.instantiate(binary, info);
}).then(receiver, function (reason) {
err("failed to asynchronously prepare wasm: " + reason);
abort(reason)
})
abort(reason);
});
}

function instantiateAsync() {
console.log(wasmBinary, typeof WebAssembly.instantiateStreaming, wasmBinaryFile, isDataURI(wasmBinaryFile), typeof fetch)
if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && typeof fetch === "function") {
fetch(wasmBinaryFile, {
credentials: "same-origin"
}).then(function (response) {
var result = WebAssembly.instantiateStreaming(response, info);
return result.then(receiveInstantiatedSource, function (reason) {
err("wasm streaming compile failed: " + reason);
err("falling back to ArrayBuffer instantiation");
instantiateArrayBuffer(receiveInstantiatedSource)
})
})
return WebAssembly.instantiateStreaming(response, info);
}).then(receiveInstantiatedSource, function (reason) {
err("wasm streaming compile failed: " + reason);
err("falling back to ArrayBuffer instantiation");
instantiateArrayBuffer(receiveInstantiatedSource);
});
} else {
return instantiateArrayBuffer(receiveInstantiatedSource)
instantiateArrayBuffer(receiveInstantiatedSource);
}
}

if (Module["instantiateWasm"]) {
try {
var exports = Module["instantiateWasm"](info, receiveInstance);
return exports
return exports;
} catch (e) {
err("Module.instantiateWasm callback failed with error: " + e);
return false
return false;
}
}

instantiateAsync();
return {}
return {};
}
var tempDouble;
var tempI64;
Expand Down

0 comments on commit 10c6380

Please sign in to comment.