blob: 141af90fd2d9d9432747277fc7d38ab6f53ea1f5 [file] [log] [blame]
Victor Porof6e096922022-06-10 13:01:05 +00001// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: WebAssembly JavaScript Interface (https://webassembly.github.io/spec/js-api/)
5
6dictionary WebAssemblyInstantiatedSource {
7 required Module module;
8 required Instance instance;
9};
10
11[Exposed=(Window,Worker,Worklet)]
12namespace WebAssembly {
13 boolean validate(BufferSource bytes);
14 Promise<Module> compile(BufferSource bytes);
15
16 Promise<WebAssemblyInstantiatedSource> instantiate(
17 BufferSource bytes, optional object importObject);
18
19 Promise<Instance> instantiate(
20 Module moduleObject, optional object importObject);
21};
22
23enum ImportExportKind {
24 "function",
25 "table",
26 "memory",
27 "global"
28};
29
30dictionary ModuleExportDescriptor {
31 required USVString name;
32 required ImportExportKind kind;
33 // Note: Other fields such as signature may be added in the future.
34};
35
36dictionary ModuleImportDescriptor {
37 required USVString module;
38 required USVString name;
39 required ImportExportKind kind;
40};
41
42[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
43interface Module {
44 constructor(BufferSource bytes);
45 static sequence<ModuleExportDescriptor> exports(Module moduleObject);
46 static sequence<ModuleImportDescriptor> imports(Module moduleObject);
47 static sequence<ArrayBuffer> customSections(Module moduleObject, DOMString sectionName);
48};
49
50[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
51interface Instance {
52 constructor(Module module, optional object importObject);
53 readonly attribute object exports;
54};
55
56dictionary MemoryDescriptor {
57 required [EnforceRange] unsigned long initial;
58 [EnforceRange] unsigned long maximum;
59};
60
61[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
62interface Memory {
63 constructor(MemoryDescriptor descriptor);
64 unsigned long grow([EnforceRange] unsigned long delta);
65 readonly attribute ArrayBuffer buffer;
66};
67
68enum TableKind {
69 "externref",
70 "anyfunc",
71 // Note: More values may be added in future iterations,
72 // e.g., typed function references, typed GC references
73};
74
75dictionary TableDescriptor {
76 required TableKind element;
77 required [EnforceRange] unsigned long initial;
78 [EnforceRange] unsigned long maximum;
79};
80
81[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
82interface Table {
83 constructor(TableDescriptor descriptor, optional any value);
84 unsigned long grow([EnforceRange] unsigned long delta, optional any value);
85 any get([EnforceRange] unsigned long index);
86 undefined set([EnforceRange] unsigned long index, optional any value);
87 readonly attribute unsigned long length;
88};
89
90enum ValueType {
91 "i32",
92 "i64",
93 "f32",
94 "f64",
95 "v128",
96 "externref",
97 "anyfunc",
98};
99
100dictionary GlobalDescriptor {
101 required ValueType value;
102 boolean mutable = false;
103};
104
105[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
106interface Global {
107 constructor(GlobalDescriptor descriptor, optional any v);
108 any valueOf();
109 attribute any value;
110};