WebAssembly.Global
Create a global variable that can be imported into a WASM module. Any changes made to the global in JavaScript is seen in the WASM module. Also, any change made to the global inside the WASM module is seen in JavaScript. You can share the global with any number of WASM modules (of the same time or different).

Constructor

const global = new WebAssembly.Global(options, value);

Parameters

options
Declares what the data type of the global is what its starting value is.
options.value
The data type the global uses. This can be one of the following text values, i32, i64, f32 or f64.
options.mutable
Can the global variable be changed. By default this is set to "false", which means it is immutable (cannot be changed). Setting this to "true" means it is mutable (can be changed).
value
The starting value of the global variable.

Example

;; Import global from a WebAssembly.Global object (with mutable = true)
(global $upperLimit (import "import" "upperLimit") (mut i32))
// Create some WASM global object
const upperLimit = new WebAssembly.Global({ value: 'i32', mutable: true }, 404);

// Set options
const options = {
  import: {
    upperLimit: upperLimit
  }
}