News for hackers. Stuff that matters.
Re:Moonbit: The fast, compact and user friendly language for... by 10000truths on Saturday August 19, 2023 @08:53AM (#37188278)
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.

There are no comments on this comment yet.