UNPKG

@dynatrace/js-runtime

Version:

This package provides the Dynatrace JavaScript runtime used by the [Dynatrace App Toolkit](https://www.npmjs.com/package/dt-app).

1,286 lines (1,224 loc) 134 kB
/// <reference no-default-lib="true" /> /// <reference lib="esnext" /> declare module 'runtime' { global { /** * Returns the application ID * @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav */ var appId: string; /** * Returns the tenant ID * @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav */ var tenantId: string; /** * Returns the environment URL * @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav */ var environmentUrl: string; /** * The `Resumable` class is a primitive for building [resumable functions](https://dt-url.net/iv23pj3). * * Functions that return a `Resumable` are invoked by Dynatrace AppEngine again * at a later time to allow for asynchronous operations running in the background. */ interface ResumableConstructor { /** * Resume an invocation of this function by returning a Resumable. * @param payload Payload passed to the following invocation of the resumed function. */ new(payload?: any): Resumable; } interface Resumable { payload: any; } var Resumable: ResumableConstructor; } } declare var global: Window & typeof globalThis; // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Documentation partially adapted from [MDN](https://developer.mozilla.org/), // by Mozilla Contributors, which is licensed under CC-BY-SA 2.5. /// <reference no-default-lib="true" /> /// <reference lib="esnext" /> // DT-disabled // /// <reference lib="deno.console" /> // DT-disabled // /// <reference lib="deno.url" /> // DT-disabled // /// <reference lib="deno.web" /> // DT-disabled // /// <reference lib="deno.webgpu" /> // DT-disabled // /// <reference lib="deno.canvas" /> // DT-disabled // /// <reference lib="deno.fetch" /> // DT-disabled // /// <reference lib="deno.websocket" /> // DT-disabled // /// <reference lib="deno.crypto" /> // DT-disabled // /** @category WASM */ // DT-disabled // declare namespace WebAssembly { // DT-disabled // /** // DT-disabled // * The `WebAssembly.CompileError` object indicates an error during WebAssembly decoding or validation. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class CompileError extends Error { // DT-disabled // /** Creates a new `WebAssembly.CompileError` object. */ // DT-disabled // constructor(message?: string, options?: ErrorOptions); // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * A `WebAssembly.Global` object represents a global variable instance, accessible from // DT-disabled // * both JavaScript and importable/exportable across one or more `WebAssembly.Module` // DT-disabled // * instances. This allows dynamic linking of multiple modules. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Global) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class Global { // DT-disabled // /** Creates a new `Global` object. */ // DT-disabled // constructor(descriptor: GlobalDescriptor, v?: any); // DT-disabled // // DT-disabled // /** // DT-disabled // * The value contained inside the global variable — this can be used to directly set // DT-disabled // * and get the global's value. // DT-disabled // */ // DT-disabled // value: any; // DT-disabled // // DT-disabled // /** Old-style method that returns the value contained inside the global variable. */ // DT-disabled // valueOf(): any; // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * A `WebAssembly.Instance` object is a stateful, executable instance of a `WebAssembly.Module`. // DT-disabled // * Instance objects contain all the Exported WebAssembly functions that allow calling into // DT-disabled // * WebAssembly code from JavaScript. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class Instance { // DT-disabled // /** Creates a new Instance object. */ // DT-disabled // constructor(module: Module, importObject?: Imports); // DT-disabled // // DT-disabled // /** // DT-disabled // * Returns an object containing as its members all the functions exported from the // DT-disabled // * WebAssembly module instance, to allow them to be accessed and used by JavaScript. // DT-disabled // * Read-only. // DT-disabled // */ // DT-disabled // readonly exports: Exports; // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.LinkError` object indicates an error during module instantiation // DT-disabled // * (besides traps from the start function). // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class LinkError extends Error { // DT-disabled // /** Creates a new WebAssembly.LinkError object. */ // DT-disabled // constructor(message?: string, options?: ErrorOptions); // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.Memory` object is a resizable `ArrayBuffer` or `SharedArrayBuffer` that // DT-disabled // * holds the raw bytes of memory accessed by a WebAssembly Instance. // DT-disabled // * // DT-disabled // * A memory created by JavaScript or in WebAssembly code will be accessible and mutable // DT-disabled // * from both JavaScript and WebAssembly. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class Memory { // DT-disabled // /** Creates a new `Memory` object. */ // DT-disabled // constructor(descriptor: MemoryDescriptor); // DT-disabled // // DT-disabled // /** An accessor property that returns the buffer contained in the memory. */ // DT-disabled // readonly buffer: ArrayBuffer | SharedArrayBuffer; // DT-disabled // // DT-disabled // /** // DT-disabled // * Increases the size of the memory instance by a specified number of WebAssembly // DT-disabled // * pages (each one is 64KB in size). // DT-disabled // */ // DT-disabled // grow(delta: number): number; // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * A `WebAssembly.Module` object contains stateless WebAssembly code that has already been compiled // DT-disabled // * by the browser — this can be efficiently shared with Workers, and instantiated multiple times. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class Module { // DT-disabled // /** Creates a new `Module` object. */ // DT-disabled // constructor(bytes: BufferSource); // DT-disabled // // DT-disabled // /** // DT-disabled // * Given a `Module` and string, returns a copy of the contents of all custom sections in the // DT-disabled // * module with the given string name. // DT-disabled // */ // DT-disabled // static customSections( // DT-disabled // moduleObject: Module, // DT-disabled // sectionName: string, // DT-disabled // ): ArrayBuffer[]; // DT-disabled // // DT-disabled // /** Given a `Module`, returns an array containing descriptions of all the declared exports. */ // DT-disabled // static exports(moduleObject: Module): ModuleExportDescriptor[]; // DT-disabled // // DT-disabled // /** Given a `Module`, returns an array containing descriptions of all the declared imports. */ // DT-disabled // static imports(moduleObject: Module): ModuleImportDescriptor[]; // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.RuntimeError` object is the error type that is thrown whenever WebAssembly // DT-disabled // * specifies a trap. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/RuntimeError) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class RuntimeError extends Error { // DT-disabled // /** Creates a new `WebAssembly.RuntimeError` object. */ // DT-disabled // constructor(message?: string, options?: ErrorOptions); // DT-disabled // } // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.Table()` object is a JavaScript wrapper object — an array-like structure // DT-disabled // * representing a WebAssembly Table, which stores function references. A table created by // DT-disabled // * JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript // DT-disabled // * and WebAssembly. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export class Table { // DT-disabled // /** Creates a new `Table` object. */ // DT-disabled // constructor(descriptor: TableDescriptor); // DT-disabled // // DT-disabled // /** Returns the length of the table, i.e. the number of elements. */ // DT-disabled // readonly length: number; // DT-disabled // // DT-disabled // /** Accessor function — gets the element stored at a given index. */ // DT-disabled // get(index: number): Function | null; // DT-disabled // // DT-disabled // /** Increases the size of the `Table` instance by a specified number of elements. */ // DT-disabled // grow(delta: number): number; // DT-disabled // // DT-disabled // /** Sets an element stored at a given index to a given value. */ // DT-disabled // set(index: number, value: Function | null): void; // DT-disabled // } // DT-disabled // // DT-disabled // /** The `GlobalDescriptor` describes the options you can pass to // DT-disabled // * `new WebAssembly.Global()`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface GlobalDescriptor { // DT-disabled // mutable?: boolean; // DT-disabled // value: ValueType; // DT-disabled // } // DT-disabled // // DT-disabled // /** The `MemoryDescriptor` describes the options you can pass to // DT-disabled // * `new WebAssembly.Memory()`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface MemoryDescriptor { // DT-disabled // initial: number; // DT-disabled // maximum?: number; // DT-disabled // shared?: boolean; // DT-disabled // } // DT-disabled // // DT-disabled // /** A `ModuleExportDescriptor` is the description of a declared export in a // DT-disabled // * `WebAssembly.Module`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface ModuleExportDescriptor { // DT-disabled // kind: ImportExportKind; // DT-disabled // name: string; // DT-disabled // } // DT-disabled // // DT-disabled // /** A `ModuleImportDescriptor` is the description of a declared import in a // DT-disabled // * `WebAssembly.Module`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface ModuleImportDescriptor { // DT-disabled // kind: ImportExportKind; // DT-disabled // module: string; // DT-disabled // name: string; // DT-disabled // } // DT-disabled // // DT-disabled // /** The `TableDescriptor` describes the options you can pass to // DT-disabled // * `new WebAssembly.Table()`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface TableDescriptor { // DT-disabled // element: TableKind; // DT-disabled // initial: number; // DT-disabled // maximum?: number; // DT-disabled // } // DT-disabled // // DT-disabled // /** The value returned from `WebAssembly.instantiate`. // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export interface WebAssemblyInstantiatedSource { // DT-disabled // /* A `WebAssembly.Instance` object that contains all the exported WebAssembly functions. */ // DT-disabled // instance: Instance; // DT-disabled // // DT-disabled // /** // DT-disabled // * A `WebAssembly.Module` object representing the compiled WebAssembly module. // DT-disabled // * This `Module` can be instantiated again, or shared via postMessage(). // DT-disabled // */ // DT-disabled // module: Module; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category WASM */ // DT-disabled // export type ImportExportKind = "function" | "global" | "memory" | "table"; // DT-disabled // /** @category WASM */ // DT-disabled // export type TableKind = "anyfunc"; // DT-disabled // /** @category WASM */ // DT-disabled // export type ValueType = "f32" | "f64" | "i32" | "i64"; // DT-disabled // /** @category WASM */ // DT-disabled // export type ExportValue = Function | Global | Memory | Table; // DT-disabled // /** @category WASM */ // DT-disabled // export type Exports = Record<string, ExportValue>; // DT-disabled // /** @category WASM */ // DT-disabled // export type ImportValue = ExportValue | number; // DT-disabled // /** @category WASM */ // DT-disabled // export type ModuleImports = Record<string, ImportValue>; // DT-disabled // /** @category WASM */ // DT-disabled // export type Imports = Record<string, ModuleImports>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.compile()` function compiles WebAssembly binary code into a // DT-disabled // * `WebAssembly.Module` object. This function is useful if it is necessary to compile // DT-disabled // * a module before it can be instantiated (otherwise, the `WebAssembly.instantiate()` // DT-disabled // * function should be used). // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compile) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function compile(bytes: BufferSource): Promise<Module>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.compileStreaming()` function compiles a `WebAssembly.Module` // DT-disabled // * directly from a streamed underlying source. This function is useful if it is // DT-disabled // * necessary to a compile a module before it can be instantiated (otherwise, the // DT-disabled // * `WebAssembly.instantiateStreaming()` function should be used). // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/compileStreaming) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function compileStreaming( // DT-disabled // source: Response | Promise<Response>, // DT-disabled // ): Promise<Module>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The WebAssembly.instantiate() function allows you to compile and instantiate // DT-disabled // * WebAssembly code. // DT-disabled // * // DT-disabled // * This overload takes the WebAssembly binary code, in the form of a typed // DT-disabled // * array or ArrayBuffer, and performs both compilation and instantiation in one step. // DT-disabled // * The returned Promise resolves to both a compiled WebAssembly.Module and its first // DT-disabled // * WebAssembly.Instance. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function instantiate( // DT-disabled // bytes: BufferSource, // DT-disabled // importObject?: Imports, // DT-disabled // ): Promise<WebAssemblyInstantiatedSource>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The WebAssembly.instantiate() function allows you to compile and instantiate // DT-disabled // * WebAssembly code. // DT-disabled // * // DT-disabled // * This overload takes an already-compiled WebAssembly.Module and returns // DT-disabled // * a Promise that resolves to an Instance of that Module. This overload is useful // DT-disabled // * if the Module has already been compiled. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function instantiate( // DT-disabled // moduleObject: Module, // DT-disabled // importObject?: Imports, // DT-disabled // ): Promise<Instance>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.instantiateStreaming()` function compiles and instantiates a // DT-disabled // * WebAssembly module directly from a streamed underlying source. This is the most // DT-disabled // * efficient, optimized way to load wasm code. // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function instantiateStreaming( // DT-disabled // response: Response | PromiseLike<Response>, // DT-disabled // importObject?: Imports, // DT-disabled // ): Promise<WebAssemblyInstantiatedSource>; // DT-disabled // // DT-disabled // /** // DT-disabled // * The `WebAssembly.validate()` function validates a given typed array of // DT-disabled // * WebAssembly binary code, returning whether the bytes form a valid wasm // DT-disabled // * module (`true`) or not (`false`). // DT-disabled // * // DT-disabled // * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/validate) // DT-disabled // * // DT-disabled // * @category WASM // DT-disabled // */ // DT-disabled // export function validate(bytes: BufferSource): boolean; // DT-disabled // } /** Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns * an id which may be used to cancel the timeout. * * ```ts * setTimeout(() => { console.log('hello'); }, 500); * ``` * * @category Platform */ declare function setTimeout( /** callback function to execute when timer expires */ cb: (...args: any[]) => void, /** delay in ms */ delay?: number, /** arguments passed to callback function */ ...args: any[] ): number; /** Repeatedly calls a function , with a fixed time delay between each call. * * ```ts * // Outputs 'hello' to the console every 500ms * setInterval(() => { console.log('hello'); }, 500); * ``` * * @category Platform */ declare function setInterval( /** callback function to execute when timer expires */ cb: (...args: any[]) => void, /** delay in ms */ delay?: number, /** arguments passed to callback function */ ...args: any[] ): number; /** Cancels a timed, repeating action which was previously started by a call * to `setInterval()` * * ```ts * const id = setInterval(() => {console.log('hello');}, 500); * // ... * clearInterval(id); * ``` * * @category Platform */ declare function clearInterval(id?: number): void; /** Cancels a scheduled action initiated by `setTimeout()` * * ```ts * const id = setTimeout(() => {console.log('hello');}, 500); * // ... * clearTimeout(id); * ``` * * @category Platform */ declare function clearTimeout(id?: number): void; /** @category Platform */ declare interface VoidFunction { (): void; } /** 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. * * ```ts * queueMicrotask(() => { console.log('This event loop stack is complete'); }); * ``` * * @category Platform */ declare function queueMicrotask(func: VoidFunction): void; /** 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. * * ```ts * dispatchEvent(new Event('unload')); * ``` * * @category Events */ declare function dispatchEvent(event: Event): boolean; /** @category Platform */ declare interface DOMStringList { /** 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; } /** @category Platform */ declare type BufferSource = ArrayBufferView | ArrayBuffer; // DT-disabled // /** @category I/O */ declare var console: Console; /** @category Events */ declare interface ErrorEventInit extends EventInit { message?: string; filename?: string; lineno?: number; colno?: number; error?: any; } /** @category Events */ declare interface ErrorEvent extends Event { readonly message: string; readonly filename: string; readonly lineno: number; readonly colno: number; readonly error: any; } /** @category Events */ declare var ErrorEvent: { readonly prototype: ErrorEvent; new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; }; /** @category Events */ declare interface PromiseRejectionEventInit extends EventInit { promise: Promise<any>; reason?: any; } /** @category Events */ declare interface PromiseRejectionEvent extends Event { readonly promise: Promise<any>; readonly reason: any; } /** @category Events */ declare var PromiseRejectionEvent: { readonly prototype: PromiseRejectionEvent; new( type: string, eventInitDict?: PromiseRejectionEventInit, ): PromiseRejectionEvent; }; // DT-disabled // // DT-disabled // /** @category Workers */ // DT-disabled // declare interface AbstractWorkerEventMap { // DT-disabled // "error": ErrorEvent; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Workers */ // DT-disabled // declare interface WorkerEventMap extends AbstractWorkerEventMap { // DT-disabled // "message": MessageEvent; // DT-disabled // "messageerror": MessageEvent; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Workers */ // DT-disabled // declare interface WorkerOptions { // DT-disabled // type?: "classic" | "module"; // DT-disabled // name?: string; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Workers */ // DT-disabled // declare interface Worker extends EventTarget { // DT-disabled // onerror: (this: Worker, e: ErrorEvent) => any | null; // DT-disabled // onmessage: (this: Worker, e: MessageEvent) => any | null; // DT-disabled // onmessageerror: (this: Worker, e: MessageEvent) => any | null; // DT-disabled // postMessage(message: any, transfer: Transferable[]): void; // DT-disabled // postMessage(message: any, options?: StructuredSerializeOptions): void; // DT-disabled // addEventListener<K extends keyof WorkerEventMap>( // DT-disabled // type: K, // DT-disabled // listener: (this: Worker, ev: WorkerEventMap[K]) => any, // DT-disabled // options?: boolean | AddEventListenerOptions, // DT-disabled // ): void; // DT-disabled // addEventListener( // DT-disabled // type: string, // DT-disabled // listener: EventListenerOrEventListenerObject, // DT-disabled // options?: boolean | AddEventListenerOptions, // DT-disabled // ): void; // DT-disabled // removeEventListener<K extends keyof WorkerEventMap>( // DT-disabled // type: K, // DT-disabled // listener: (this: Worker, ev: WorkerEventMap[K]) => any, // DT-disabled // options?: boolean | EventListenerOptions, // DT-disabled // ): void; // DT-disabled // removeEventListener( // DT-disabled // type: string, // DT-disabled // listener: EventListenerOrEventListenerObject, // DT-disabled // options?: boolean | EventListenerOptions, // DT-disabled // ): void; // DT-disabled // terminate(): void; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Workers */ // DT-disabled // declare var Worker: { // DT-disabled // readonly prototype: Worker; // DT-disabled // new (specifier: string | URL, options?: WorkerOptions): Worker; // DT-disabled // }; // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare type PerformanceEntryList = PerformanceEntry[]; // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare interface Performance extends EventTarget { // DT-disabled // /** Returns a timestamp representing the start of the performance measurement. */ // DT-disabled // readonly timeOrigin: number; // DT-disabled // // DT-disabled // /** Removes the stored timestamp with the associated name. */ // DT-disabled // clearMarks(markName?: string): void; // DT-disabled // // DT-disabled // /** Removes stored timestamp with the associated name. */ // DT-disabled // clearMeasures(measureName?: string): void; // DT-disabled // // DT-disabled // getEntries(): PerformanceEntryList; // DT-disabled // getEntriesByName(name: string, type?: string): PerformanceEntryList; // DT-disabled // getEntriesByType(type: string): PerformanceEntryList; // DT-disabled // // DT-disabled // /** Stores a timestamp with the associated name (a "mark"). */ // DT-disabled // mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark; // DT-disabled // // DT-disabled // /** Stores the `DOMHighResTimeStamp` duration between two marks along with the // DT-disabled // * associated name (a "measure"). */ // DT-disabled // measure( // DT-disabled // measureName: string, // DT-disabled // options?: PerformanceMeasureOptions, // DT-disabled // ): PerformanceMeasure; // DT-disabled // /** Stores the `DOMHighResTimeStamp` duration between two marks along with the // DT-disabled // * associated name (a "measure"). */ // DT-disabled // measure( // DT-disabled // measureName: string, // DT-disabled // startMark?: string, // DT-disabled // endMark?: string, // DT-disabled // ): PerformanceMeasure; // DT-disabled // // DT-disabled // /** Returns a current time from Deno's start in milliseconds. // DT-disabled // * // DT-disabled // * Use the permission flag `--allow-hrtime` to return a precise value. // DT-disabled // * // DT-disabled // * ```ts // DT-disabled // * const t = performance.now(); // DT-disabled // * console.log(`${t} ms since start!`); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * @tags allow-hrtime // DT-disabled // */ // DT-disabled // now(): number; // DT-disabled // // DT-disabled // /** Returns a JSON representation of the performance object. */ // DT-disabled // toJSON(): any; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare var Performance: { // DT-disabled // readonly prototype: Performance; // DT-disabled // new (): never; // DT-disabled // }; // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare var performance: Performance; // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare interface PerformanceMarkOptions { // DT-disabled // /** Metadata to be included in the mark. */ // DT-disabled // detail?: any; // DT-disabled // // DT-disabled // /** Timestamp to be used as the mark time. */ // DT-disabled // startTime?: number; // DT-disabled // } // DT-disabled // // DT-disabled // /** @category Performance */ // DT-disabled // declare interface PerformanceMeasureOptions { // DT-disabled // /** Metadata to be included in the measure. */ // DT-disabled // detail?: any; // DT-disabled // // DT-disabled // /** Timestamp to be used as the start time or string to be used as start // DT-disabled // * mark. */ // DT-disabled // start?: string | number; // DT-disabled // // DT-disabled // /** Duration between the start and end times. */ // DT-disabled // duration?: number; // DT-disabled // // DT-disabled // /** Timestamp to be used as the end time or string to be used as end mark. */ // DT-disabled // end?: string | number; // DT-disabled // } // DT-disabled // // DT-disabled // /** Encapsulates a single performance metric that is part of the performance // DT-disabled // * timeline. A performance entry can be directly created by making a performance // DT-disabled // * mark or measure (for example by calling the `.mark()` method) at an explicit // DT-disabled // * point in an application. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare interface PerformanceEntry { // DT-disabled // readonly duration: number; // DT-disabled // readonly entryType: string; // DT-disabled // readonly name: string; // DT-disabled // readonly startTime: number; // DT-disabled // toJSON(): any; // DT-disabled // } // DT-disabled // // DT-disabled // /** Encapsulates a single performance metric that is part of the performance // DT-disabled // * timeline. A performance entry can be directly created by making a performance // DT-disabled // * mark or measure (for example by calling the `.mark()` method) at an explicit // DT-disabled // * point in an application. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare var PerformanceEntry: { // DT-disabled // readonly prototype: PerformanceEntry; // DT-disabled // new (): never; // DT-disabled // }; // DT-disabled // // DT-disabled // /** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects // DT-disabled // * with an entryType of `"mark"`. Entries of this type are created by calling // DT-disabled // * `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the // DT-disabled // * performance timeline. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare interface PerformanceMark extends PerformanceEntry { // DT-disabled // readonly detail: any; // DT-disabled // readonly entryType: "mark"; // DT-disabled // } // DT-disabled // // DT-disabled // /** `PerformanceMark` is an abstract interface for `PerformanceEntry` objects // DT-disabled // * with an entryType of `"mark"`. Entries of this type are created by calling // DT-disabled // * `performance.mark()` to add a named `DOMHighResTimeStamp` (the mark) to the // DT-disabled // * performance timeline. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare var PerformanceMark: { // DT-disabled // readonly prototype: PerformanceMark; // DT-disabled // new (name: string, options?: PerformanceMarkOptions): PerformanceMark; // DT-disabled // }; // DT-disabled // // DT-disabled // /** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects // DT-disabled // * with an entryType of `"measure"`. Entries of this type are created by calling // DT-disabled // * `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure) // DT-disabled // * between two marks to the performance timeline. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare interface PerformanceMeasure extends PerformanceEntry { // DT-disabled // readonly detail: any; // DT-disabled // readonly entryType: "measure"; // DT-disabled // } // DT-disabled // // DT-disabled // /** `PerformanceMeasure` is an abstract interface for `PerformanceEntry` objects // DT-disabled // * with an entryType of `"measure"`. Entries of this type are created by calling // DT-disabled // * `performance.measure()` to add a named `DOMHighResTimeStamp` (the measure) // DT-disabled // * between two marks to the performance timeline. // DT-disabled // * // DT-disabled // * @category Performance // DT-disabled // */ // DT-disabled // declare var PerformanceMeasure: { // DT-disabled // readonly prototype: PerformanceMeasure; // DT-disabled // new (): never; // DT-disabled // }; /** @category Events */ declare interface CustomEventInit<T = any> extends EventInit { detail?: T; } /** @category Events */ declare interface CustomEvent<T = any> extends Event { /** Returns any custom data event was created with. Typically used for * synthetic events. */ readonly detail: T; } /** @category Events */ declare var CustomEvent: { readonly prototype: CustomEvent; new <T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>; }; /** @category Platform */ declare interface ErrorConstructor { /** 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. } // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. /// <reference no-default-lib="true" /> // DT-disabled // /// <reference lib="deno.ns" /> // DT-disabled // /// <reference lib="deno.shared_globals" /> // DT-disabled // /// <reference lib="deno.webstorage" /> /// <reference lib="esnext" /> // DT-disabled // /// <reference lib="deno.cache" /> /** @category Platform */ declare interface WindowEventMap { "error": ErrorEvent; "unhandledrejection": PromiseRejectionEvent; "rejectionhandled": PromiseRejectionEvent; } /** @category Platform */ declare interface Window extends EventTarget { readonly window: Window & typeof globalThis; readonly self: Window & typeof globalThis; onerror: ((this: Window, ev: ErrorEvent) => any) | null; onload: ((this: Window, ev: Event) => any) | null; onbeforeunload: ((this: Window, ev: Event) => any) | null; onunload: ((this: Window, ev: Event) => any) | null; onunhandledrejection: | ((this: Window, ev: PromiseRejectionEvent) => any) | null; onrejectionhandled: | ((this: Window, ev: PromiseRejectionEvent) => any) | null; // DT-disabled // close: () => void; // DT-disabled // readonly closed: boolean; // DT-disabled // alert: (message?: string) => void; // DT-disabled // confirm: (message?: string) => boolean; // DT-disabled // prompt: (message?: string, defaultValue?: string) => string | null; // DT-disabled // Deno: typeof Deno; Navigator: typeof Navigator; navigator: Navigator; // DT-disabled // Location: typeof Location; // DT-disabled // location: Location; // DT-disabled // localStorage: Storage; // DT-disabled // sessionStorage: Storage; // DT-disabled // caches: CacheStorage; name: string; addEventListener<K extends keyof WindowEventMap>( type: K, listener: ( this: Window, ev: WindowEventMap[K], ) => any, options?: boolean | AddEventListenerOptions, ): void; addEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, ): void; removeEventListener<K extends keyof WindowEventMap>( type: K, listener: ( this: Window, ev: WindowEventMap[K], ) => any, options?: boolean | EventListenerOptions, ): void; removeEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions, ): void; } /** @category Platform */ declare var Window: { readonly prototype: Window; new(): never; }; /** @category Platform */ declare var window: Window & typeof globalThis; /** @category Platform */ declare var self: Window & typeof globalThis; // DT-disabled // /** @category Platform */ // DT-disabled // declare var closed: boolean; // DT-disabled // /** @category Platform */ // DT-disabled // declare function close(): void; /** @category Events */ declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null; /** @category Events */ declare var onload: ((this: Window, ev: Event) => any) | null; /** @category Events */ declare var onbeforeunload: ((this: Window, ev: Event) => any) | null; /** @category Events */ declare var onunload: ((this: Window, ev: Event) => any) | null; /** @category Events */ declare var onunhandledrejection: | ((this: Window, ev: PromiseRejectionEvent) => any) | null; // DT-disabled // /** @category Storage */ // DT-disabled // declare var localStorage: Storage; // DT-disabled // /** @category Storage */ // DT-disabled // declare var sessionStorage: Storage; // DT-disabled // /** @category Cache */ // DT-disabled // declare var caches: CacheStorage; /** @category Platform */ declare interface Navigator { // DT-disabled // readonly gpu: GPU; readonly hardwareConcurrency: number; readonly userAgent: string; readonly language: string; readonly languages: string[]; } /** @category Platform */ declare var Navigator: { readonly prototype: Navigator; new(): never; }; /** @category Platform */ declare var navigator: Navigator; // DT-disabled // /** // DT-disabled // * Shows the given message and waits for the enter key pressed. // DT-disabled // * // DT-disabled // * If the stdin is not interactive, it does nothing. // DT-disabled // * // DT-disabled // * @category Platform // DT-disabled // * // DT-disabled // * @param message // DT-disabled // */ // DT-disabled // declare function alert(message?: string): void; // DT-disabled // // DT-disabled // /** // DT-disabled // * Shows the given message and waits for the answer. Returns the user's answer as boolean. // DT-disabled // * // DT-disabled // * Only `y` and `Y` are considered as true. // DT-disabled // * // DT-disabled // * If the stdin is not interactive, it returns false. // DT-disabled // * // DT-disabled // * @category Platform // DT-disabled // * // DT-disabled // * @param message // DT-disabled // */ // DT-disabled // declare function confirm(message?: string): boolean; // DT-disabled // // DT-disabled // /** // DT-disabled // * Shows the given message and waits for the user's input. Returns the user's input as string. // DT-disabled // * // DT-disabled // * If the default value is given and the user inputs the empty string, then it returns the given // DT-disabled // * default value. // DT-disabled // * // DT-disabled // * If the default value is not given and the user inputs the empty string, it returns the empty // DT-disabled // * string. // DT-disabled // * // DT-disabled // * If the stdin is not interactive, it returns null. // DT-disabled // * // DT-disabled // * @category Platform // DT-disabled // * // DT-disabled // * @param message // DT-disabled // * @param defaultValue // DT-disabled // */ // DT-disabled // declare function prompt(message?: string, defaultValue?: string): string | null; // DT-disabled // // DT-disabled // /** Registers an event listener in the global scope, which will be called // DT-disabled // * synchronously whenever the event `type` is dispatched. // DT-disabled // * // DT-disabled // * ```ts // DT-disabled // * addEventListener('unload', () => { console.log('All finished!'); }); // DT-disabled // * ... // DT-disabled // * dispatchEvent(new Event('unload')); // DT-disabled // * ``` // DT-disabled // * // DT-disabled // * @category Events // DT-disabled // */ declare function addEventListener< K extends keyof WindowEventMap, >( type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions, ): void; /** @category Events */ declare function addEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, ): void; /** Remove a previously registered event listener from the global scope * * ```ts * const listener = () => { console.log('hello'); }; * addEventListener('load', listener); * removeEventListener('load', listener); * ``` * * @category Events */ declare function removeEventListener< K extends keyof WindowEventMap, >( type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions, ): void; /** @category Events */ declare function removeEventListener( type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions, ): void; // TODO(nayeemrmn): Move this to `extensions/web` where its implementation is. // The types there must first be split into window, worker and global types. /** The location (URL) of the object it is linked to. Changes done on it are * reflected on the object it relates to. Accessible via * `globalThis.location`. * * @category Platform */ declare interface Location { /** Returns a DOMStringList object listing the origins of the ancestor * browsing contexts, from the parent browsing context to the top-level * browsing context. * * Always empty in Deno. */ readonly ancestorOrigins: DOMStringList; /** Returns the Location object's URL's fragment (includes leading "#" if * non-empty). * * Cannot be set in Deno. */ hash: string; /** Returns the Location object's URL's host and port (if different from the * default port for the scheme). * * Cannot be set in Deno. */ host: string; /** Returns the Location object's URL's host. * * Cannot be set in Deno. */ hostname: string; /** Returns the Location object's URL. * * Cannot be set in Deno. */ href: string; toString(): string; /** Returns the Location object's URL's origin. */ readonly origin: string; /** Returns the Location object's URL's path. * * Cannot be set in Deno. */ pathname: string; /** Returns the Location object's URL's port. * * Cannot be set in Deno. */ port: string; /** Returns the Location object's URL's scheme. * * Cannot be set in Deno. */ protocol: string; /** Returns the Location object's URL's query (includes leading "?" if * non-empty). * * Cannot be set in Deno. */ search: string; /** Navigates to the given URL. * * Cannot be set in Deno. */ assign(url: string): void; /** Reloads the current page. * * Disabled in Deno. */ reload(): void; /** @deprecated */ reload(forcedReload: boolean): void; /** Removes the current page from the session history and navigates to the * given URL. * * Disabled in Deno. */ replace(url: string): void; } // TODO(nayeemrmn): Move this to `extensions/web` where its implementation is. // The types there must first be split into window, worker and global types. /** The location (URL) of the object it is linked to. Changes done on it are * reflected on the object it relates to. Accessible via * `globalThis.location`. * * @category Platform */ declare var Location: { readonly prototype: Location; new(): never; }; // TODO(nayeemrmn): Move this to `extensions/web` where its implementation is. // The types there must first be split into window, worker and global types. /** @category Platform */ declare var location: Location; /** @category Platform */ declare var name: string; // Copyright 2018-2025 the Deno authors. MIT license. // deno-lint-ignore-file no-explicit-any /// <reference no-default-lib="true" /> /// <reference lib="esnext" /> /** @category I/O */ /** * The Console interface provides methods for logging information to the console, * as well as other utility methods for debugging and inspecting code. * @see https://developer.mozilla.org/en-US/docs/Web/API/console */ /** Interface representing the console object that provides methods for logging, debugging, and timing */ interface Console { /** * Tests that an expression is true. If not, logs an error message * @param condition The expression to test for truthiness * @param data Additional arguments to be printed if the assertion fails * @example * ```ts * console.assert(1 === 1, "This won't show"); * console.assert(1 === 2, "This will show an error"); * ``` */ assert(condition?: boolean, ...data: any[]): void; /** * Clears the console if the environment allows it * @example * ```ts * console.clear(); * ``` */ clear(): void; /** * Maintains an internal counter for a given label, incrementing it each time the method is called * @param label The label to count. Defaults to 'default' * @example * ```ts * console.count('myCounter'); * console.count('myCounter'); // Will show: myCounter: 2 * ``` */ count(label?: string): void; /** * Resets the counter for a given label * @param label The label to reset. Defaults to 'default' * @example * ```ts * console.count('myCounter'); * console.countReset('myCounter'); // Resets to 0 * ``` */ countReset(label?: string): void; /** * Outputs a debugging message to the console * @param data Values to be printed to the console * @example * ```ts * console.debug('Debug message', { detail: 'some data' }); * ``` */ debug(...data: any[]): void; /** * Displays a list of the properties of a specified object * @param item Object to display * @param options Formatting options * @example * ```ts * console.dir({ name: 'object', value: 42 }, { depth: 1 }); * ``` */ dir(item?: any, options?: any): void; /** * @ignore */ dirxml(...data: any[]): void; /** * Outputs an error message to the console. * This method routes the output to stderr, * unlike other console methods that route to stdout. * @param data Values to be printed to the console * @example * ```ts * console.error('Error occurred:', new Error('Something went wrong')); * ``` */ error(...data: any[]): void; /** * Creates a new inline group in the console, indenting subsequent console messages * @param data Labels for the group * @example * ```ts * console.group('Group 1'); * console.log('Inside group 1'); * console.groupEnd(); * ``` */ group(...data: any[]): void; /** * Creates a new inline group in the console that is initially collapsed * @param data Labels for the group * @example * ```ts * console.groupCollapsed('Details'); * console.log('Hidden until expanded'); * console.groupEnd(); * ``` */ groupCollapsed(...data: any[]): void; /** * Exits the current inline group in the console * @example * ```ts * console.group('Group'); * console.log('Grouped message'); * console.groupEnd(); * ``` */ groupEnd(): void; /** * Outputs an informational message to the console * @param data Values to be printed to the console * @example * ```ts * console.info('Application started', { version: '1.0.0' }); * ``` */ info(...data: any[]): void; /** * Outputs a message to the console * @param data Values to be printed to the console * @example * ```ts * console.log('Hello', 'World', 123); * ``` */ log(...data: any[]): void; /** * Displays tabular data as a table * @param tabularData Data to be displayed in table format * @param properties Array of property names to be displayed * @example * ```ts * console.table([ * { name: 'John', age: 30 }, * { name: 'Jane', age: 25 } * ]); * ``` */ table(tabularData?: any, properties?: string[]): void; /** * Starts a timer you can use to track how long an operation takes * @param label Timer label. Defaults to 'default' * @example * ```ts * console.time('operation'); * // ... some code * console.timeEnd('operation'); * ``` */ time(label?: string): void; /** * Stops a timer that was previously started * @param label Timer label to stop. Defaults to 'default' * @example * ```ts * console.time('operation'); * // ... some code * console.timeEnd('operation'); // Prints: operation: 1234ms * ``` */ timeEnd(label?: string): void; /** * Logs the current value of a timer that was previously