2024-01-01 14:58:21 -05:00
|
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2020-01-24 14:15:01 -05:00
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
// Documentation partially adapted from [MDN](https://developer.mozilla.org/),
|
|
|
|
|
// by Mozilla Contributors, which is licensed under CC-BY-SA 2.5.
|
|
|
|
|
|
2020-01-24 14:15:01 -05:00
|
|
|
|
/// <reference no-default-lib="true" />
|
|
|
|
|
/// <reference lib="esnext" />
|
2021-03-12 15:23:59 -05:00
|
|
|
|
/// <reference lib="deno.console" />
|
chore: split web op crate (#9635)
This commit starts splitting out the deno_web op crate into multiple
smaller crates. This commit splits out WebIDL and URL API, but in the
future I want to split out each spec into its own crate. That means we
will have (in rough order of loading): `webidl`, `dom`, `streams`,
`console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and
`webgpu` crates.
2021-03-12 10:17:18 -05:00
|
|
|
|
/// <reference lib="deno.url" />
|
2020-08-07 10:55:02 -04:00
|
|
|
|
/// <reference lib="deno.web" />
|
2024-01-22 06:08:01 -05:00
|
|
|
|
/// <reference lib="deno.webgpu" />
|
|
|
|
|
/// <reference lib="deno.canvas" />
|
2020-09-18 09:20:55 -04:00
|
|
|
|
/// <reference lib="deno.fetch" />
|
2021-01-06 10:57:28 -05:00
|
|
|
|
/// <reference lib="deno.websocket" />
|
2021-02-26 12:06:26 -05:00
|
|
|
|
/// <reference lib="deno.crypto" />
|
2020-01-24 14:15:01 -05:00
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-02-23 09:40:44 -05:00
|
|
|
|
declare namespace WebAssembly {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.CompileError` object indicates an error during WebAssembly decoding or validation.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
|
|
|
|
export class CompileError extends Error {
|
|
|
|
|
/** Creates a new `WebAssembly.CompileError` object. */
|
2022-07-14 14:42:54 -04:00
|
|
|
|
constructor(message?: string, options?: ErrorOptions);
|
2020-09-25 10:21:34 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* A `WebAssembly.Global` object represents a global variable instance, accessible from
|
|
|
|
|
* both JavaScript and importable/exportable across one or more `WebAssembly.Module`
|
|
|
|
|
* instances. This allows dynamic linking of multiple modules.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export class Global {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/** Creates a new `Global` object. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
constructor(descriptor: GlobalDescriptor, v?: any);
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The value contained inside the global variable — this can be used to directly set
|
|
|
|
|
* and get the global's value.
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
value: any;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Old-style method that returns the value contained inside the global variable. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
valueOf(): any;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* A `WebAssembly.Instance` object is a stateful, executable instance of a `WebAssembly.Module`.
|
|
|
|
|
* Instance objects contain all the Exported WebAssembly functions that allow calling into
|
|
|
|
|
* WebAssembly code from JavaScript.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export class Instance {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/** Creates a new Instance object. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
constructor(module: Module, importObject?: Imports);
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns an object containing as its members all the functions exported from the
|
|
|
|
|
* WebAssembly module instance, to allow them to be accessed and used by JavaScript.
|
|
|
|
|
* Read-only.
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
readonly exports: Exports;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.LinkError` object indicates an error during module instantiation
|
|
|
|
|
* (besides traps from the start function).
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
|
|
|
|
export class LinkError extends Error {
|
|
|
|
|
/** Creates a new WebAssembly.LinkError object. */
|
2022-07-14 14:42:54 -04:00
|
|
|
|
constructor(message?: string, options?: ErrorOptions);
|
2020-09-25 10:21:34 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.Memory` object is a resizable `ArrayBuffer` or `SharedArrayBuffer` that
|
|
|
|
|
* holds the raw bytes of memory accessed by a WebAssembly Instance.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* A memory created by JavaScript or in WebAssembly code will be accessible and mutable
|
|
|
|
|
* from both JavaScript and WebAssembly.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export class Memory {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/** Creates a new `Memory` object. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
constructor(descriptor: MemoryDescriptor);
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** An accessor property that returns the buffer contained in the memory. */
|
2021-04-26 11:54:07 -04:00
|
|
|
|
readonly buffer: ArrayBuffer | SharedArrayBuffer;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Increases the size of the memory instance by a specified number of WebAssembly
|
|
|
|
|
* pages (each one is 64KB in size).
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
grow(delta: number): number;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* A `WebAssembly.Module` object contains stateless WebAssembly code that has already been compiled
|
|
|
|
|
* by the browser — this can be efficiently shared with Workers, and instantiated multiple times.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export class Module {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/** Creates a new `Module` object. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
constructor(bytes: BufferSource);
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Given a `Module` and string, returns a copy of the contents of all custom sections in the
|
|
|
|
|
* module with the given string name.
|
2021-09-02 18:28:12 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
static customSections(
|
|
|
|
|
moduleObject: Module,
|
|
|
|
|
sectionName: string,
|
|
|
|
|
): ArrayBuffer[];
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Given a `Module`, returns an array containing descriptions of all the declared exports. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
static exports(moduleObject: Module): ModuleExportDescriptor[];
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Given a `Module`, returns an array containing descriptions of all the declared imports. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
static imports(moduleObject: Module): ModuleImportDescriptor[];
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.RuntimeError` object is the error type that is thrown whenever WebAssembly
|
|
|
|
|
* specifies a trap.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
|
|
|
|
export class RuntimeError extends Error {
|
|
|
|
|
/** Creates a new `WebAssembly.RuntimeError` object. */
|
2022-07-14 14:42:54 -04:00
|
|
|
|
constructor(message?: string, options?: ErrorOptions);
|
2020-09-25 10:21:34 -04:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.Table()` object is a JavaScript wrapper object — an array-like structure
|
|
|
|
|
* representing a WebAssembly Table, which stores function references. A table created by
|
|
|
|
|
* JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript
|
|
|
|
|
* and WebAssembly.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export class Table {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/** Creates a new `Table` object. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
constructor(descriptor: TableDescriptor);
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Returns the length of the table, i.e. the number of elements. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
readonly length: number;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Accessor function — gets the element stored at a given index. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
get(index: number): Function | null;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Increases the size of the `Table` instance by a specified number of elements. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
grow(delta: number): number;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/** Sets an element stored at a given index to a given value. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
set(index: number, value: Function | null): void;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** The `GlobalDescriptor` describes the options you can pass to
|
|
|
|
|
* `new WebAssembly.Global()`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface GlobalDescriptor {
|
|
|
|
|
mutable?: boolean;
|
|
|
|
|
value: ValueType;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** The `MemoryDescriptor` describes the options you can pass to
|
|
|
|
|
* `new WebAssembly.Memory()`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface MemoryDescriptor {
|
|
|
|
|
initial: number;
|
|
|
|
|
maximum?: number;
|
2021-04-26 11:54:07 -04:00
|
|
|
|
shared?: boolean;
|
2020-09-25 10:21:34 -04:00
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** A `ModuleExportDescriptor` is the description of a declared export in a
|
|
|
|
|
* `WebAssembly.Module`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface ModuleExportDescriptor {
|
|
|
|
|
kind: ImportExportKind;
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** A `ModuleImportDescriptor` is the description of a declared import in a
|
|
|
|
|
* `WebAssembly.Module`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface ModuleImportDescriptor {
|
|
|
|
|
kind: ImportExportKind;
|
|
|
|
|
module: string;
|
|
|
|
|
name: string;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** The `TableDescriptor` describes the options you can pass to
|
|
|
|
|
* `new WebAssembly.Table()`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface TableDescriptor {
|
|
|
|
|
element: TableKind;
|
|
|
|
|
initial: number;
|
|
|
|
|
maximum?: number;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** The value returned from `WebAssembly.instantiate`.
|
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export interface WebAssemblyInstantiatedSource {
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/* A `WebAssembly.Instance` object that contains all the exported WebAssembly functions. */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
instance: Instance;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A `WebAssembly.Module` object representing the compiled WebAssembly module.
|
|
|
|
|
* This `Module` can be instantiated again, or shared via postMessage().
|
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
module: Module;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type ImportExportKind = "function" | "global" | "memory" | "table";
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type TableKind = "anyfunc";
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type ValueType = "f32" | "f64" | "i32" | "i64";
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type ExportValue = Function | Global | Memory | Table;
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type Exports = Record<string, ExportValue>;
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type ImportValue = ExportValue | number;
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type ModuleImports = Record<string, ImportValue>;
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category WebAssembly */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export type Imports = Record<string, ModuleImports>;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
2020-10-02 22:57:31 -04:00
|
|
|
|
/**
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* The `WebAssembly.compile()` function compiles WebAssembly binary code into a
|
|
|
|
|
* `WebAssembly.Module` object. This function is useful if it is necessary to compile
|
|
|
|
|
* a module before it can be instantiated (otherwise, the `WebAssembly.instantiate()`
|
|
|
|
|
* function should be used).
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compile)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export function compile(bytes: BufferSource): Promise<Module>;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
2021-07-03 17:33:36 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.compileStreaming()` function compiles a `WebAssembly.Module`
|
|
|
|
|
* directly from a streamed underlying source. This function is useful if it is
|
|
|
|
|
* necessary to a compile a module before it can be instantiated (otherwise, the
|
|
|
|
|
* `WebAssembly.instantiateStreaming()` function should be used).
|
|
|
|
|
*
|
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2021-07-03 17:33:36 -04:00
|
|
|
|
*/
|
|
|
|
|
export function compileStreaming(
|
|
|
|
|
source: Response | Promise<Response>,
|
|
|
|
|
): Promise<Module>;
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The WebAssembly.instantiate() function allows you to compile and instantiate
|
|
|
|
|
* WebAssembly code.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* This overload takes the WebAssembly binary code, in the form of a typed
|
|
|
|
|
* array or ArrayBuffer, and performs both compilation and instantiation in one step.
|
|
|
|
|
* The returned Promise resolves to both a compiled WebAssembly.Module and its first
|
|
|
|
|
* WebAssembly.Instance.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export function instantiate(
|
|
|
|
|
bytes: BufferSource,
|
|
|
|
|
importObject?: Imports,
|
|
|
|
|
): Promise<WebAssemblyInstantiatedSource>;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The WebAssembly.instantiate() function allows you to compile and instantiate
|
|
|
|
|
* WebAssembly code.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* This overload takes an already-compiled WebAssembly.Module and returns
|
|
|
|
|
* a Promise that resolves to an Instance of that Module. This overload is useful
|
|
|
|
|
* if the Module has already been compiled.
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export function instantiate(
|
|
|
|
|
moduleObject: Module,
|
|
|
|
|
importObject?: Imports,
|
|
|
|
|
): Promise<Instance>;
|
2020-09-26 14:33:20 -04:00
|
|
|
|
|
2021-07-03 17:33:36 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.instantiateStreaming()` function compiles and instantiates a
|
|
|
|
|
* WebAssembly module directly from a streamed underlying source. This is the most
|
|
|
|
|
* efficient, optimized way to load wasm code.
|
|
|
|
|
*
|
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2021-07-03 17:33:36 -04:00
|
|
|
|
*/
|
|
|
|
|
export function instantiateStreaming(
|
|
|
|
|
response: Response | PromiseLike<Response>,
|
|
|
|
|
importObject?: Imports,
|
|
|
|
|
): Promise<WebAssemblyInstantiatedSource>;
|
|
|
|
|
|
2020-09-26 14:33:20 -04:00
|
|
|
|
/**
|
|
|
|
|
* The `WebAssembly.validate()` function validates a given typed array of
|
|
|
|
|
* WebAssembly binary code, returning whether the bytes form a valid wasm
|
|
|
|
|
* module (`true`) or not (`false`).
|
2020-10-02 22:57:31 -04:00
|
|
|
|
*
|
2020-09-26 14:33:20 -04:00
|
|
|
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category WebAssembly
|
2020-09-26 14:33:20 -04:00
|
|
|
|
*/
|
2020-09-25 10:21:34 -04:00
|
|
|
|
export function validate(bytes: BufferSource): boolean;
|
2020-02-23 09:40:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-22 10:04:28 -04:00
|
|
|
|
/** Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns
|
2020-05-30 11:19:16 -04:00
|
|
|
|
* an id which may be used to cancel the timeout.
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* setTimeout(() => { console.log('hello'); }, 500);
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category Timers
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
2020-04-07 11:12:31 -04:00
|
|
|
|
declare function setTimeout(
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** callback function to execute when timer expires */
|
2020-05-15 09:51:49 -04:00
|
|
|
|
cb: (...args: any[]) => void,
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** delay in ms */
|
2020-04-07 11:12:31 -04:00
|
|
|
|
delay?: number,
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** arguments passed to callback function */
|
2020-05-15 09:51:49 -04:00
|
|
|
|
...args: any[]
|
2020-04-07 11:12:31 -04:00
|
|
|
|
): number;
|
2020-04-11 11:42:02 -04:00
|
|
|
|
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** Repeatedly calls a function , with a fixed time delay between each call.
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* // Outputs 'hello' to the console every 500ms
|
|
|
|
|
* setInterval(() => { console.log('hello'); }, 500);
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category Timers
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
2020-04-07 11:12:31 -04:00
|
|
|
|
declare function setInterval(
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** callback function to execute when timer expires */
|
2020-05-15 09:51:49 -04:00
|
|
|
|
cb: (...args: any[]) => void,
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** delay in ms */
|
2020-04-07 11:12:31 -04:00
|
|
|
|
delay?: number,
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** arguments passed to callback function */
|
2020-05-15 09:51:49 -04:00
|
|
|
|
...args: any[]
|
2020-04-07 11:12:31 -04:00
|
|
|
|
): number;
|
2020-05-30 11:19:16 -04:00
|
|
|
|
|
|
|
|
|
/** Cancels a timed, repeating action which was previously started by a call
|
|
|
|
|
* to `setInterval()`
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* const id = setInterval(() => {console.log('hello');}, 500);
|
|
|
|
|
* // ...
|
|
|
|
|
* clearInterval(id);
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category Timers
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
2020-04-07 11:12:31 -04:00
|
|
|
|
declare function clearInterval(id?: number): void;
|
2020-05-30 11:19:16 -04:00
|
|
|
|
|
|
|
|
|
/** Cancels a scheduled action initiated by `setTimeout()`
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* const id = setTimeout(() => {console.log('hello');}, 500);
|
|
|
|
|
* // ...
|
|
|
|
|
* clearTimeout(id);
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category Timers
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
|
|
|
|
declare function clearTimeout(id?: number): void;
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Scheduling */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface VoidFunction {
|
2020-07-03 06:44:45 -04:00
|
|
|
|
(): void;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** A microtask is a short function which is executed after the function or
|
|
|
|
|
* module which created it exits and only if the JavaScript execution stack is
|
|
|
|
|
* empty, but before returning control to the event loop being used to drive the
|
|
|
|
|
* script's execution environment. This event loop may be either the main event
|
|
|
|
|
* loop or the event loop driving a web worker.
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* queueMicrotask(() => { console.log('This event loop stack is complete'); });
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category Scheduling
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
2020-07-03 06:44:45 -04:00
|
|
|
|
declare function queueMicrotask(func: VoidFunction): void;
|
2020-01-29 12:54:23 -05:00
|
|
|
|
|
2020-05-30 11:19:16 -04:00
|
|
|
|
/** Dispatches an event in the global scope, synchronously invoking any
|
|
|
|
|
* registered event listeners for this event in the appropriate order. Returns
|
|
|
|
|
* false if event is cancelable and at least one of the event handlers which
|
|
|
|
|
* handled this event called Event.preventDefault(). Otherwise it returns true.
|
|
|
|
|
*
|
2021-12-16 20:36:03 -05:00
|
|
|
|
* ```ts
|
|
|
|
|
* dispatchEvent(new Event('unload'));
|
|
|
|
|
* ```
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*
|
|
|
|
|
* @category DOM Events
|
2020-05-30 11:19:16 -04:00
|
|
|
|
*/
|
2020-04-09 06:03:44 -04:00
|
|
|
|
declare function dispatchEvent(event: Event): boolean;
|
2020-04-08 13:21:04 -04:00
|
|
|
|
|
2022-09-12 03:30:43 -04:00
|
|
|
|
/** @category DOM APIs */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface DOMStringList {
|
2020-04-10 14:24:42 -04:00
|
|
|
|
/** Returns the number of strings in strings. */
|
|
|
|
|
readonly length: number;
|
|
|
|
|
/** Returns true if strings contains string, and false otherwise. */
|
|
|
|
|
contains(string: string): boolean;
|
|
|
|
|
/** Returns the string with index index from strings. */
|
|
|
|
|
item(index: number): string | null;
|
|
|
|
|
[index: number]: string;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Typed Arrays */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare type BufferSource = ArrayBufferView | ArrayBuffer;
|
2020-04-10 09:51:17 -04:00
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Console and Debugging */
|
2020-09-24 06:40:33 -04:00
|
|
|
|
declare var console: Console;
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category DOM Events */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface ErrorEventInit extends EventInit {
|
2020-04-13 12:34:32 -04:00
|
|
|
|
message?: string;
|
|
|
|
|
filename?: string;
|
|
|
|
|
lineno?: number;
|
|
|
|
|
colno?: number;
|
|
|
|
|
error?: any;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category DOM Events */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface ErrorEvent extends Event {
|
2020-04-13 12:34:32 -04:00
|
|
|
|
readonly message: string;
|
|
|
|
|
readonly filename: string;
|
|
|
|
|
readonly lineno: number;
|
|
|
|
|
readonly colno: number;
|
|
|
|
|
readonly error: any;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** @category DOM Events */
|
|
|
|
|
declare var ErrorEvent: {
|
|
|
|
|
readonly prototype: ErrorEvent;
|
|
|
|
|
new (type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Observability */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface PromiseRejectionEventInit extends EventInit {
|
2022-07-20 14:28:19 -04:00
|
|
|
|
promise: Promise<any>;
|
|
|
|
|
reason?: any;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Observability */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface PromiseRejectionEvent extends Event {
|
2022-07-20 14:28:19 -04:00
|
|
|
|
readonly promise: Promise<any>;
|
|
|
|
|
readonly reason: any;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** @category Observability */
|
|
|
|
|
declare var PromiseRejectionEvent: {
|
|
|
|
|
readonly prototype: PromiseRejectionEvent;
|
|
|
|
|
new (
|
|
|
|
|
type: string,
|
|
|
|
|
eventInitDict?: PromiseRejectionEventInit,
|
|
|
|
|
): PromiseRejectionEvent;
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Web Workers */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface AbstractWorkerEventMap {
|
2020-10-02 22:57:31 -04:00
|
|
|
|
"error": ErrorEvent;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Web Workers */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface WorkerEventMap extends AbstractWorkerEventMap {
|
2020-10-02 22:57:31 -04:00
|
|
|
|
"message": MessageEvent;
|
|
|
|
|
"messageerror": MessageEvent;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Web Workers */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface WorkerOptions {
|
2021-01-18 21:26:39 -05:00
|
|
|
|
type?: "classic" | "module";
|
|
|
|
|
name?: string;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category Web Workers */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface Worker extends EventTarget {
|
2024-01-18 17:42:04 -05:00
|
|
|
|
onerror: (this: Worker, e: ErrorEvent) => any | null;
|
|
|
|
|
onmessage: (this: Worker, e: MessageEvent) => any | null;
|
|
|
|
|
onmessageerror: (this: Worker, e: MessageEvent) => any | null;
|
2021-06-22 10:30:16 -04:00
|
|
|
|
postMessage(message: any, transfer: Transferable[]): void;
|
2021-08-09 04:39:00 -04:00
|
|
|
|
postMessage(message: any, options?: StructuredSerializeOptions): void;
|
2020-10-02 22:57:31 -04:00
|
|
|
|
addEventListener<K extends keyof WorkerEventMap>(
|
|
|
|
|
type: K,
|
|
|
|
|
listener: (this: Worker, ev: WorkerEventMap[K]) => any,
|
|
|
|
|
options?: boolean | AddEventListenerOptions,
|
|
|
|
|
): void;
|
|
|
|
|
addEventListener(
|
|
|
|
|
type: string,
|
|
|
|
|
listener: EventListenerOrEventListenerObject,
|
|
|
|
|
options?: boolean | AddEventListenerOptions,
|
|
|
|
|
): void;
|
|
|
|
|
removeEventListener<K extends keyof WorkerEventMap>(
|
|
|
|
|
type: K,
|
|
|
|
|
listener: (this: Worker, ev: WorkerEventMap[K]) => any,
|
|
|
|
|
options?: boolean | EventListenerOptions,
|
|
|
|
|
): void;
|
|
|
|
|
removeEventListener(
|
|
|
|
|
type: string,
|
|
|
|
|
listener: EventListenerOrEventListenerObject,
|
|
|
|
|
options?: boolean | EventListenerOptions,
|
|
|
|
|
): void;
|
2020-04-07 15:03:14 -04:00
|
|
|
|
terminate(): void;
|
2020-01-24 14:15:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** @category Web Workers */
|
|
|
|
|
declare var Worker: {
|
|
|
|
|
readonly prototype: Worker;
|
|
|
|
|
new (specifier: string | URL, options?: WorkerOptions): Worker;
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-28 16:21:08 -04:00
|
|
|
|
/** @category Performance */
|
2020-07-10 22:38:15 -04:00
|
|
|
|
declare type PerformanceEntryList = PerformanceEntry[];
|
|
|
|
|
|
2022-09-28 16:21:08 -04:00
|
|
|
|
/** @category Performance */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface Performance extends EventTarget {
|
2022-05-13 12:36:00 -04:00
|
|
|
|
/** Returns a timestamp representing the start of the performance measurement. */
|
2022-05-06 13:37:18 -04:00
|
|
|
|
readonly timeOrigin: number;
|
2020-09-25 10:21:34 -04:00
|
|
|
|
|
2020-07-10 22:38:15 -04:00
|
|
|
|
/** Removes the stored timestamp with the associated name. */
|
|
|
|
|
clearMarks(markName?: string): void;
|
|
|
|
|
|
|
|
|
|
/** Removes stored timestamp with the associated name. */
|
|
|
|
|
clearMeasures(measureName?: string): void;
|
|
|
|
|
|
|
|
|
|
getEntries(): PerformanceEntryList;
|
|
|
|
|
getEntriesByName(name: string, type?: string): PerformanceEntryList;
|
|
|
|
|
getEntriesByType(type: string): PerformanceEntryList;
|
|
|
|
|
|
|
|
|
|
/** Stores a timestamp with the associated name (a "mark"). */
|
|
|
|
|
mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark;
|
|
|
|
|
|
|
|
|
|
/** Stores the `DOMHighResTimeStamp` duration between two marks along with the
|
|
|
|
|
* associated name (a "measure"). */
|
|
|
|
|
measure(
|
|
|
|
|
measureName: string,
|
2020-07-14 15:24:17 -04:00
|
|
|
|
options?: PerformanceMeasureOptions,
|
2020-07-10 22:38:15 -04:00
|
|
|
|
): PerformanceMeasure;
|
|
|
|
|
/** Stores the `DOMHighResTimeStamp` duration between two marks along with the
|
|
|
|
|
* associated name (a "measure"). */
|
|
|
|
|
measure(
|
|
|
|
|
measureName: string,
|
|
|
|
|
startMark?: string,
|
2020-07-14 15:24:17 -04:00
|
|
|
|
endMark?: string,
|
2020-07-10 22:38:15 -04:00
|
|
|
|
): PerformanceMeasure;
|
|
|
|
|
|
2020-04-07 13:27:37 -04:00
|
|
|
|
/** Returns a current time from Deno's start in milliseconds.
|
|
|
|
|
*
|
2023-06-16 08:38:36 -04:00
|
|
|
|
* Use the permission flag `--allow-hrtime` to return a precise value.
|
2020-04-07 13:27:37 -04:00
|
|
|
|
*
|
2020-05-16 15:23:48 -04:00
|
|
|
|
* ```ts
|
|
|
|
|
* const t = performance.now();
|
|
|
|
|
* console.log(`${t} ms since start!`);
|
|
|
|
|
* ```
|
2022-08-22 20:57:01 -04:00
|
|
|
|
*
|
|
|
|
|
* @tags allow-hrtime
|
2020-04-07 13:27:37 -04:00
|
|
|
|
*/
|
2020-07-10 22:38:15 -04:00
|
|
|
|
now(): number;
|
2022-05-13 12:36:00 -04:00
|
|
|
|
|
|
|
|
|
/** Returns a JSON representation of the performance object. */
|
|
|
|
|
toJSON(): any;
|
2020-07-10 22:38:15 -04:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** @category Performance */
|
|
|
|
|
declare var Performance: {
|
|
|
|
|
readonly prototype: Performance;
|
|
|
|
|
new (): never;
|
|
|
|
|
};
|
|
|
|
|
|
2022-09-28 16:21:08 -04:00
|
|
|
|
/** @category Performance */
|
2020-09-25 17:23:35 -04:00
|
|
|
|
declare var performance: Performance;
|
2020-07-10 22:38:15 -04:00
|
|
|
|
|
2022-09-28 16:21:08 -04:00
|
|
|
|
/** @category Performance */
|
2020-07-10 22:38:15 -04:00
|
|
|
|
declare interface PerformanceMarkOptions {
|
|
|
|
|
/** Metadata to be included in the mark. */
|
|
|
|
|
detail?: any;
|
|
|
|
|
|
|
|
|
|
/** Timestamp to be used as the mark time. */
|
|
|
|
|
startTime?: number;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-26 12:04:29 -04:00
|
|
|
|
/** @category Performance */
|
2020-07-10 22:38:15 -04:00
|
|
|
|
declare interface PerformanceMeasureOptions {
|
|
|
|
|
/** Metadata to be included in the measure. */
|
|
|
|
|
detail?: any;
|
|
|
|
|
|
|
|
|
|
/** Timestamp to be used as the start time or string to be used as start
|
2021-09-02 18:28:12 -04:00
|
|
|
|
* mark. */
|
2020-07-10 22:38:15 -04:00
|
|
|
|
start?: string | number;
|
|
|
|
|
|
|
|
|
|
/** Duration between the start and end times. */
|
|
|
|
|
duration?: number;
|
|
|
|
|
|
|
|
|
|
/** Timestamp to be used as the end time or string to be used as end mark. */
|
|
|
|
|
end?: string | number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Encapsulates a single performance metric that is part of the performance
|
|
|
|
|
* timeline. A performance entry can be directly created by making a performance
|
|
|
|
|
* mark or measure (for example by calling the `.mark()` method) at an explicit
|
2022-08-16 23:12:24 -04:00
|
|
|
|
* point in an application.
|
|
|
|
|
*
|
2022-09-28 16:21:08 -04:00
|
|
|
|
* @category Performance
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*/
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface PerformanceEntry {
|
2020-07-10 22:38:15 -04:00
|
|
|
|
readonly duration: number;
|
|
|
|
|
readonly entryType: string;
|
|
|
|
|
readonly name: string;
|
|
|
|
|
readonly startTime: number;
|
|
|
|
|
toJSON(): any;
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** Encapsulates a single performance metric that is part of the performance
|
|
|
|
|
* timeline. A performance entry can be directly created by making a performance
|
|
|
|
|
* mark or measure (for example by calling the `.mark()` method) at an explicit
|
|
|
|
|
* point in an application.
|
|
|
|
|
*
|
|
|
|
|
* @category Performance
|
|
|
|
|
*/
|
|
|
|
|
declare var PerformanceEntry: {
|
|
|
|
|
readonly prototype: PerformanceEntry;
|
|
|
|
|
new (): never;
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-10 22:38:15 -04:00
|
|
|
|
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
|
|
|
|
|
* with an entryType of `"mark"`. Entries of this type are created by calling
|
|
|
|
|
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
|
2022-08-16 23:12:24 -04:00
|
|
|
|
* performance timeline.
|
|
|
|
|
*
|
2022-09-28 16:21:08 -04:00
|
|
|
|
* @category Performance
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*/
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface PerformanceMark extends PerformanceEntry {
|
2020-07-10 22:38:15 -04:00
|
|
|
|
readonly detail: any;
|
|
|
|
|
readonly entryType: "mark";
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects
|
|
|
|
|
* with an entryType of `"mark"`. Entries of this type are created by calling
|
|
|
|
|
* `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the
|
|
|
|
|
* performance timeline.
|
|
|
|
|
*
|
|
|
|
|
* @category Performance
|
|
|
|
|
*/
|
|
|
|
|
declare var PerformanceMark: {
|
|
|
|
|
readonly prototype: PerformanceMark;
|
|
|
|
|
new (name: string, options?: PerformanceMarkOptions): PerformanceMark;
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-10 22:38:15 -04:00
|
|
|
|
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
|
|
|
|
|
* with an entryType of `"measure"`. Entries of this type are created by calling
|
|
|
|
|
* `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure)
|
2022-08-16 23:12:24 -04:00
|
|
|
|
* between two marks to the performance timeline.
|
|
|
|
|
*
|
2022-09-28 16:21:08 -04:00
|
|
|
|
* @category Performance
|
2022-08-16 23:12:24 -04:00
|
|
|
|
*/
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface PerformanceMeasure extends PerformanceEntry {
|
2020-07-10 22:38:15 -04:00
|
|
|
|
readonly detail: any;
|
|
|
|
|
readonly entryType: "measure";
|
2020-01-24 14:15:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects
|
|
|
|
|
* with an entryType of `"measure"`. Entries of this type are created by calling
|
|
|
|
|
* `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure)
|
|
|
|
|
* between two marks to the performance timeline.
|
|
|
|
|
*
|
|
|
|
|
* @category Performance
|
|
|
|
|
*/
|
|
|
|
|
declare var PerformanceMeasure: {
|
|
|
|
|
readonly prototype: PerformanceMeasure;
|
|
|
|
|
new (): never;
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category DOM Events */
|
2020-09-25 10:21:34 -04:00
|
|
|
|
declare interface CustomEventInit<T = any> extends EventInit {
|
2020-04-09 06:03:44 -04:00
|
|
|
|
detail?: T;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-16 23:12:24 -04:00
|
|
|
|
/** @category DOM Events */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface CustomEvent<T = any> extends Event {
|
2020-04-11 11:42:02 -04:00
|
|
|
|
/** Returns any custom data event was created with. Typically used for
|
|
|
|
|
* synthetic events. */
|
|
|
|
|
readonly detail: T;
|
|
|
|
|
}
|
2020-04-10 09:51:17 -04:00
|
|
|
|
|
2023-07-03 14:36:55 -04:00
|
|
|
|
/** @category DOM Events */
|
|
|
|
|
declare var CustomEvent: {
|
|
|
|
|
readonly prototype: CustomEvent;
|
|
|
|
|
new <T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-30 07:16:56 -04:00
|
|
|
|
/** @category DOM APIs */
|
2023-07-03 14:36:55 -04:00
|
|
|
|
declare interface ErrorConstructor {
|
2020-05-29 08:02:36 -04:00
|
|
|
|
/** See https://v8.dev/docs/stack-trace-api#stack-trace-collection-for-custom-exceptions. */
|
|
|
|
|
captureStackTrace(error: Object, constructor?: Function): void;
|
|
|
|
|
// TODO(nayeemrmn): Support `Error.prepareStackTrace()`. We currently use this
|
|
|
|
|
// internally in a way that makes it unavailable for users.
|
|
|
|
|
}
|