Skip to content

Commit

Permalink
Use wasm from window object, not from js script
Browse files Browse the repository at this point in the history
  • Loading branch information
ilgonmic committed Jan 30, 2024
1 parent b46f98b commit 56def06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/js-executor/execute-es-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function executeWasmCode(container, jsCode, wasmCode) {
`'${skikoWasm}'`
);
const skikoImport = 'data:text/javascript;base64,' + btoa(skikoCode);
container.wasmCode = Uint8Array.from(atob(wasmCode), c => c.charCodeAt(0));
const newCode = `
class BufferedOutput {
constructor() {
Expand All @@ -20,7 +21,7 @@ export async function executeWasmCode(container, jsCode, wasmCode) {
jsCode
.replace(
"instantiateStreaming(fetch(wasmFilePath)",
"instantiate(Uint8Array.from(atob(" + "'" + wasmCode + "'" + "), c => c.charCodeAt(0))"
"instantiate(window.wasmCode"
)
.replace(
"const importObject = {",
Expand Down

0 comments on commit 56def06

Please sign in to comment.