1+ /// <reference lib="es2015" />
2+ /// <reference lib="es2018.asynciterable" />
3+
14/////////////////////////////
25/// AudioWorklet APIs
36/////////////////////////////
@@ -57,6 +60,10 @@ interface QueuingStrategyInit {
5760 highWaterMark : number ;
5861}
5962
63+ interface ReadableStreamBYOBReaderReadOptions {
64+ min ?: number ;
65+ }
66+
6067interface ReadableStreamGetReaderOptions {
6168 /**
6269 * Creates a ReadableStreamBYOBReader and locks the stream to the new reader.
@@ -952,7 +959,7 @@ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
952959 *
953960 * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ReadableStreamBYOBReader/read)
954961 */
955- read < T extends ArrayBufferView > ( view : T ) : Promise < ReadableStreamReadResult < T > > ;
962+ read < T extends ArrayBufferView > ( view : T , options ?: ReadableStreamBYOBReaderReadOptions ) : Promise < ReadableStreamReadResult < T > > ;
956963 /**
957964 * The **`releaseLock()`** method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream.
958965 *
@@ -1540,6 +1547,37 @@ declare namespace WebAssembly {
15401547 ( message ?: string ) : CompileError ;
15411548 } ;
15421549
1550+ /**
1551+ * The **`WebAssembly.Exception`** object represents a runtime exception thrown from WebAssembly to JavaScript, or thrown from JavaScript to a WebAssembly exception handler.
1552+ *
1553+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception)
1554+ */
1555+ interface Exception {
1556+ /**
1557+ * The read-only **`stack`** property of an object instance of type `WebAssembly.Exception` _may_ contain a stack trace.
1558+ *
1559+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/stack)
1560+ */
1561+ readonly stack : string | undefined ;
1562+ /**
1563+ * The **`getArg()`** prototype method of the `Exception` object can be used to get the value of a specified item in the exception's data arguments.
1564+ *
1565+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/getArg)
1566+ */
1567+ getArg ( index : number ) : any ;
1568+ /**
1569+ * The **`is()`** prototype method of the `Exception` object can be used to test if the `Exception` matches a given tag.
1570+ *
1571+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/is)
1572+ */
1573+ is ( exceptionTag : Tag ) : boolean ;
1574+ }
1575+
1576+ var Exception : {
1577+ prototype : Exception ;
1578+ new ( exceptionTag : Tag , payload : any [ ] , options ?: ExceptionOptions ) : Exception ;
1579+ } ;
1580+
15431581 /**
15441582 * A **`WebAssembly.Global`** object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more `WebAssembly.Module` instances.
15451583 *
@@ -1600,7 +1638,7 @@ declare namespace WebAssembly {
16001638 *
16011639 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow)
16021640 */
1603- grow ( delta : number ) : number ;
1641+ grow ( delta : AddressValue ) : AddressValue ;
16041642 }
16051643
16061644 var Memory : {
@@ -1618,7 +1656,7 @@ declare namespace WebAssembly {
16181656
16191657 var Module : {
16201658 prototype : Module ;
1621- new ( bytes : BufferSource ) : Module ;
1659+ new ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Module ;
16221660 /**
16231661 * The **`WebAssembly.Module.customSections()`** static method returns a copy of the contents of all custom sections in the given module with the given string name.
16241662 *
@@ -1659,40 +1697,58 @@ declare namespace WebAssembly {
16591697 *
16601698 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/length)
16611699 */
1662- readonly length : number ;
1700+ readonly length : AddressValue ;
16631701 /**
16641702 * The **`get()`** prototype method of the `WebAssembly.Table()` object retrieves the element stored at a given index.
16651703 *
16661704 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/get)
16671705 */
1668- get ( index : number ) : any ;
1706+ get ( index : AddressValue ) : any ;
16691707 /**
16701708 * The **`grow()`** prototype method of the `WebAssembly.Table` object increases the size of the `Table` instance by a specified number of elements, filled with the provided value.
16711709 *
16721710 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/grow)
16731711 */
1674- grow ( delta : number , value ?: any ) : number ;
1712+ grow ( delta : AddressValue , value ?: any ) : AddressValue ;
16751713 /**
16761714 * The **`set()`** prototype method of the `WebAssembly.Table` object mutates a reference stored at a given index to a different value.
16771715 *
16781716 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/set)
16791717 */
1680- set ( index : number , value ?: any ) : void ;
1718+ set ( index : AddressValue , value ?: any ) : void ;
16811719 }
16821720
16831721 var Table : {
16841722 prototype : Table ;
16851723 new ( descriptor : TableDescriptor , value ?: any ) : Table ;
16861724 } ;
16871725
1726+ /**
1727+ * The **`WebAssembly.Tag`** object defines a _type_ of a WebAssembly exception that can be thrown to/from WebAssembly code.
1728+ *
1729+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Tag)
1730+ */
1731+ interface Tag {
1732+ }
1733+
1734+ var Tag : {
1735+ prototype : Tag ;
1736+ new ( type : TagType ) : Tag ;
1737+ } ;
1738+
1739+ interface ExceptionOptions {
1740+ traceStack ?: boolean ;
1741+ }
1742+
16881743 interface GlobalDescriptor < T extends ValueType = ValueType > {
16891744 mutable ?: boolean ;
16901745 value : T ;
16911746 }
16921747
16931748 interface MemoryDescriptor {
1694- initial : number ;
1695- maximum ?: number ;
1749+ address ?: AddressType ;
1750+ initial : AddressValue ;
1751+ maximum ?: AddressValue ;
16961752 shared ?: boolean ;
16971753 }
16981754
@@ -1708,9 +1764,14 @@ declare namespace WebAssembly {
17081764 }
17091765
17101766 interface TableDescriptor {
1767+ address ?: AddressType ;
17111768 element : TableKind ;
1712- initial : number ;
1713- maximum ?: number ;
1769+ initial : AddressValue ;
1770+ maximum ?: AddressValue ;
1771+ }
1772+
1773+ interface TagType {
1774+ parameters : ValueType [ ] ;
17141775 }
17151776
17161777 interface ValueTypeMap {
@@ -1723,26 +1784,34 @@ declare namespace WebAssembly {
17231784 v128 : never ;
17241785 }
17251786
1787+ interface WebAssemblyCompileOptions {
1788+ builtins ?: string [ ] ;
1789+ importedStringConstants ?: string | null ;
1790+ }
1791+
17261792 interface WebAssemblyInstantiatedSource {
17271793 instance : Instance ;
17281794 module : Module ;
17291795 }
17301796
1731- type ImportExportKind = "function" | "global" | "memory" | "table" ;
1797+ type AddressType = "i32" | "i64" ;
1798+ type ImportExportKind = "function" | "global" | "memory" | "table" | "tag" ;
17321799 type TableKind = "anyfunc" | "externref" ;
1800+ type AddressValue = number ;
17331801 type ExportValue = Function | Global | Memory | Table ;
17341802 type Exports = Record < string , ExportValue > ;
17351803 type ImportValue = ExportValue | number ;
17361804 type Imports = Record < string , ModuleImports > ;
17371805 type ModuleImports = Record < string , ImportValue > ;
17381806 type ValueType = keyof ValueTypeMap ;
1807+ var JSTag : Tag ;
17391808 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/compile_static) */
1740- function compile ( bytes : BufferSource ) : Promise < Module > ;
1809+ function compile ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Promise < Module > ;
17411810 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/instantiate_static) */
1742- function instantiate ( bytes : BufferSource , importObject ?: Imports ) : Promise < WebAssemblyInstantiatedSource > ;
1811+ function instantiate ( bytes : BufferSource , importObject ?: Imports , options ?: WebAssemblyCompileOptions ) : Promise < WebAssemblyInstantiatedSource > ;
17431812 function instantiate ( moduleObject : Module , importObject ?: Imports ) : Promise < Instance > ;
17441813 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/validate_static) */
1745- function validate ( bytes : BufferSource ) : boolean ;
1814+ function validate ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : boolean ;
17461815}
17471816
17481817/** The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). */
@@ -1955,3 +2024,41 @@ type Transferable = MessagePort | ReadableStream | WritableStream | TransformStr
19552024type CompressionFormat = "deflate" | "deflate-raw" | "gzip" ;
19562025type ReadableStreamReaderMode = "byob" ;
19572026type ReadableStreamType = "bytes" ;
2027+
2028+
2029+ /////////////////////////////
2030+ /// AudioWorklet Iterable APIs
2031+ /////////////////////////////
2032+
2033+ interface MessageEvent < T = any > {
2034+ /** @deprecated */
2035+ initMessageEvent ( type : string , bubbles ?: boolean , cancelable ?: boolean , data ?: any , origin ?: string , lastEventId ?: string , source ?: MessageEventSource | null , ports ?: MessagePort [ ] ) : void ;
2036+ }
2037+
2038+ interface URLSearchParamsIterator < T > extends IteratorObject < T , BuiltinIteratorReturn , unknown > {
2039+ [ Symbol . iterator ] ( ) : URLSearchParamsIterator < T > ;
2040+ }
2041+
2042+ interface URLSearchParams {
2043+ [ Symbol . iterator ] ( ) : URLSearchParamsIterator < [ string , string ] > ;
2044+ /** Returns an array of key, value pairs for every entry in the search params. */
2045+ entries ( ) : URLSearchParamsIterator < [ string , string ] > ;
2046+ /** Returns a list of keys in the search params. */
2047+ keys ( ) : URLSearchParamsIterator < string > ;
2048+ /** Returns a list of values in the search params. */
2049+ values ( ) : URLSearchParamsIterator < string > ;
2050+ }
2051+
2052+
2053+ /////////////////////////////
2054+ /// AudioWorklet Async Iterable APIs
2055+ /////////////////////////////
2056+
2057+ interface ReadableStreamAsyncIterator < T > extends AsyncIteratorObject < T , BuiltinIteratorReturn , unknown > {
2058+ [ Symbol . asyncIterator ] ( ) : ReadableStreamAsyncIterator < T > ;
2059+ }
2060+
2061+ interface ReadableStream < R = any > {
2062+ [ Symbol . asyncIterator ] ( options ?: ReadableStreamIteratorOptions ) : ReadableStreamAsyncIterator < R > ;
2063+ values ( options ?: ReadableStreamIteratorOptions ) : ReadableStreamAsyncIterator < R > ;
2064+ }
0 commit comments