WebAssembly.Tag() constructor
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2022.
The WebAssembly.Tag() constructor creates a new WebAssembly.Tag object instance.
Syntax
js
new WebAssembly.Tag(type)
Parameters
type-
An object that can contain the following members:
parameters-
An array of strings representing the exception type's parameters and their types. The strings can be any Wasm type.
Exceptions
TypeError-
Thrown if at least one of these conditions is true:
- The
typeparameter is not an object. - The
type.parametersproperty is not supplied. - The
type.parametersproperty contains an unsupported data type.
- The
Examples
>Basic usage
This creates a tag with two values.
js
const tag = new WebAssembly.Tag({ parameters: ["i32", "i64"] });
Specifications
| Specification |
|---|
| WebAssembly JavaScript Interface: Exception Handling> # dom-tag-tag-type-type> |
Browser compatibility
See also
- WebAssembly overview
- WebAssembly concepts
- Using the WebAssembly JavaScript API
tagdefinitionexnreftype