File tree 7 files changed +11
-47
lines changed
7 files changed +11
-47
lines changed Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ $ ./build.sh
14
14
15
15
(or running the commands on Windows manually)
16
16
17
- and then visiting http://localhost:8080 in a browser should run the example!
17
+ and then visiting http://localhost:8000 in a browser should run the example!
Original file line number Diff line number Diff line change 3
3
set -ex
4
4
5
5
# Compile our wasm module and run `wasm-bindgen`
6
- wasm-pack build
6
+ wasm-pack build --target web
7
7
8
8
# Run the `wasm2js` tool from `binaryen`
9
9
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.js
10
10
11
- # Move our original wasm out of the way to avoid cofusing Webpack.
12
- mv pkg /wasm2js_bg.wasm pkg/wasm2js_bg.bak.wasm
11
+ # Update our JS shim to require the JS file instead
12
+ sed -i ' s /wasm2js_bg.wasm/wasm2js_bg.js/ ' pkg/wasm2js.js
13
13
14
- npm install
15
- npm run serve
14
+ http
Original file line number Diff line number Diff line change 5
5
< body >
6
6
< p > Open up the developer console to see "Hello, World!"</ p >
7
7
</ body >
8
+ < script src =index.js type =module > </ script >
8
9
</ html >
Original file line number Diff line number Diff line change 1
- // Note that since we're not using `WebAssembly` we can do a synchronous import
2
- // here!
3
- import { run } from './pkg/wasm2js' ;
4
- run ( ) ;
1
+ // Import our JS shim and initialize it, executing the start function when it's
2
+ // ready.
3
+ import init from './pkg/wasm2js.js ' ;
4
+ init ( ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ extern "C" {
7
7
fn log ( s : & str ) ;
8
8
}
9
9
10
- #[ wasm_bindgen]
10
+ #[ wasm_bindgen( start ) ]
11
11
pub fn run ( ) {
12
12
log ( "Hello, World!" ) ;
13
13
}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments