This is a very simple example of using asm.js to generate wasm binary file.
square.wast
: The source file, writing in s-expressions directly.square.wasm
: The WebAssembly binary file.index.html
: The entry point of this example.
In this example, an importObject
was passed to loadWebAssembly
method. In the square.wast
it can import the output
method and export an print
method, moreover, the output
method also called in square
method.
- Start a web server.
- Use the browser that supports WebAssembly to open the
index.html
.
- Install WABT.
- Run
./build.sh
.
WABT
square.wast ---> square.wasm