...

/

The Start Function

The Start Function

Learn how to use the start function in WebAssembly.

We'll cover the following...

The start function is a special function that runs after the WebAssembly module is initialized. Let’s take the same example that we used for the globals. We add the following content to globals.wat:

Press + to interact
(module
; Code is elided
(func $initMutableValue
(global.set $mutableValue
(i32.const 200)))
(start $initMutableValue)
)

We define the initMutableValue function, which sets mutableValue to 200. After that, we add a start block, which starts with the start ...