|
|
|
|
|
by 10000truths
1040 days ago
|
|
A WebAssembly runtime is a pure compute+memory sandbox. It can only interact with the host environment in three ways: 1. The host calls an exported WASM function 2. The WASM runtime runs code that calls an imported function 3. The host reads/writes the WASM runtime's memory/globals In your example, the WASM build process spits out two artifacts - a WASM module and a JS module. The JS module defines the actual JavaScript host functions that manipulate the canvas, and then exposes those functions to the WASM instance. |
|