(import...)
Import objects from JavaScript. You can import many different types of objects. You can only import one object at a time.
Syntax
(import configObject configProperty
(global...)
(memory...)
(func...)
(table...)
(tag...)
)
Parameters
configObject
When creating the WASM instance you can pass a config object. This name of the imported object.
configProperty
The name of the config object's property that holds the object to import.
(global...) Optional
Information about the JavaScript WebAssembly.Global
object that is being imported.
(memory...) Optional
Information about the JavaScript WebAssembly.Memory
object that is being imported.
(func...) Optional
Information about the JavaScript function that is being imported.
(table...) Optional
Information about the JavaScript WebAssembly.Table
object that is being imported.
(tag...) Optional
Information about the JavaScript WebAssembly.Tag
object that is being imported.
Examples
(import "import" "globalFromLiteral" (global $importGlobalFromLiteral i32))
const options = {
import: {
globalFromLiteral: 99
}
}
const promise = WebAssembly.instantiate(wasmData, options);