wasm-js-api.idl (3881B)
1 // 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 6 dictionary WebAssemblyInstantiatedSource { 7 required Module module; 8 required Instance instance; 9 }; 10 11 dictionary WebAssemblyCompileOptions { 12 USVString? importedStringConstants; 13 sequence<USVString> builtins; 14 }; 15 16 [Exposed=*] 17 namespace WebAssembly { 18 boolean validate(BufferSource bytes, optional WebAssemblyCompileOptions options = {}); 19 Promise<Module> compile(BufferSource bytes, optional WebAssemblyCompileOptions options = {}); 20 21 Promise<WebAssemblyInstantiatedSource> instantiate( 22 BufferSource bytes, optional object importObject, optional WebAssemblyCompileOptions options = {}); 23 24 Promise<Instance> instantiate( 25 Module moduleObject, optional object importObject); 26 27 readonly attribute Tag JSTag; 28 }; 29 30 enum ImportExportKind { 31 "function", 32 "table", 33 "memory", 34 "global", 35 "tag" 36 }; 37 38 enum AddressType { 39 "i32", 40 "i64", 41 }; 42 43 typedef any AddressValue; 44 45 dictionary ModuleExportDescriptor { 46 required USVString name; 47 required ImportExportKind kind; 48 // Note: Other fields such as signature may be added in the future. 49 }; 50 51 dictionary ModuleImportDescriptor { 52 required USVString module; 53 required USVString name; 54 required ImportExportKind kind; 55 }; 56 57 [LegacyNamespace=WebAssembly, Exposed=*] 58 interface Module { 59 constructor(BufferSource bytes, optional WebAssemblyCompileOptions options = {}); 60 static sequence<ModuleExportDescriptor> exports(Module moduleObject); 61 static sequence<ModuleImportDescriptor> imports(Module moduleObject); 62 static sequence<ArrayBuffer> customSections(Module moduleObject, DOMString sectionName); 63 }; 64 65 [LegacyNamespace=WebAssembly, Exposed=*] 66 interface Instance { 67 constructor(Module module, optional object importObject); 68 readonly attribute object exports; 69 }; 70 71 dictionary MemoryDescriptor { 72 required AddressValue initial; 73 AddressValue maximum; 74 AddressType address; 75 }; 76 77 [LegacyNamespace=WebAssembly, Exposed=*] 78 interface Memory { 79 constructor(MemoryDescriptor descriptor); 80 AddressValue grow(AddressValue delta); 81 ArrayBuffer toFixedLengthBuffer(); 82 ArrayBuffer toResizableBuffer(); 83 readonly attribute ArrayBuffer buffer; 84 }; 85 86 enum TableKind { 87 "externref", 88 "anyfunc", 89 // Note: More values may be added in future iterations, 90 // e.g., typed function references, typed GC references 91 }; 92 93 dictionary TableDescriptor { 94 required TableKind element; 95 required AddressValue initial; 96 AddressValue maximum; 97 AddressType address; 98 }; 99 100 [LegacyNamespace=WebAssembly, Exposed=*] 101 interface Table { 102 constructor(TableDescriptor descriptor, optional any value); 103 AddressValue grow(AddressValue delta, optional any value); 104 any get(AddressValue index); 105 undefined set(AddressValue index, optional any value); 106 readonly attribute AddressValue length; 107 }; 108 109 enum ValueType { 110 "i32", 111 "i64", 112 "f32", 113 "f64", 114 "v128", 115 "externref", 116 "anyfunc", 117 }; 118 119 dictionary GlobalDescriptor { 120 required ValueType value; 121 boolean mutable = false; 122 }; 123 124 [LegacyNamespace=WebAssembly, Exposed=*] 125 interface Global { 126 constructor(GlobalDescriptor descriptor, optional any v); 127 any valueOf(); 128 attribute any value; 129 }; 130 131 dictionary TagType { 132 required sequence<ValueType> parameters; 133 }; 134 135 [LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)] 136 interface Tag { 137 constructor(TagType type); 138 }; 139 140 dictionary ExceptionOptions { 141 boolean traceStack = false; 142 }; 143 144 [LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)] 145 interface Exception { 146 constructor(Tag exceptionTag, sequence<any> payload, optional ExceptionOptions options = {}); 147 any getArg([EnforceRange] unsigned long index); 148 boolean is(Tag exceptionTag); 149 readonly attribute (DOMString or undefined) stack; 150 };