Skip to content

Commit

Permalink
Fix wasm2js example (#2837)
Browse files Browse the repository at this point in the history
Co-authored-by: ambiso <ambiso@invalid>
  • Loading branch information
ambiso and ambiso authored Mar 16, 2022
1 parent a1520c4 commit 7993d91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions examples/wasm2js/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
set -ex

# Compile our wasm module and run `wasm-bindgen`
wasm-pack build --target web
wasm-pack build

# Run the `wasm2js` tool from `binaryen`
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.js
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.wasm.js

# Update our JS shim to require the JS file instead
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.js/' pkg/wasm2js.js
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js.js
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js_bg.js

http
8 changes: 4 additions & 4 deletions examples/wasm2js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Import our JS shim and initialize it, executing the start function when it's
// ready.
import init from './pkg/wasm2js.js';
init();
// Import our JS shim; will initialize by itself
import { run } from './pkg/wasm2js.js';
// Run the function a second time
run();

0 comments on commit 7993d91

Please sign in to comment.