/// /// declare interface Console { assert(condition?: boolean, ...data: any[]): void; clear(): void; count(label?: string): void; countReset(label?: string): void; debug(...data: any[]): void; dir(item?: any, options?: any): void; dirxml(...data: any[]): void; error(...data: any[]): void; group(...data: any[]): void; groupCollapsed(...data: any[]): void; groupEnd(): void; info(...data: any[]): void; log(...data: any[]): void; table(tabularData?: any, properties?: string[]): void; time(label?: string): void; timeEnd(label?: string): void; timeLog(label?: string, ...data: any[]): void; trace(...data: any[]): void; warn(...data: any[]): void; } declare class URLSearchParams { constructor( init?: string[][] | Record | string | URLSearchParams, ); static toString(): string; /** Appends a specified key/value pair as a new search parameter. * * ```ts * let searchParams = new URLSearchParams(); * searchParams.append('name', 'first'); * searchParams.append('name', 'second'); * ``` */ append(name: string, value: string): void; /** Deletes the given search parameter and its associated value, * from the list of all search parameters. * * ```ts * let searchParams = new URLSearchParams([['name', 'value']]); * searchParams.delete('name'); * ``` */ delete(name: string): void; /** Returns all the values associated with a given search parameter * as an array. * * ```ts * searchParams.getAll('name'); * ``` */ getAll(name: string): string[]; /** Returns the first value associated to the given search parameter. * * ```ts * searchParams.get('name'); * ``` */ get(name: string): string | null; /** Returns a Boolean that indicates whether a parameter with the * specified name exists. * * ```ts * searchParams.has('name'); * ``` */ has(name: string): boolean; /** Sets the value associated with a given search parameter to the * given value. If there were several matching values, this method * deletes the others. If the search parameter doesn't exist, this * method creates it. * * ```ts * searchParams.set('name', 'value'); * ``` */ set(name: string, value: string): void; /** * The total number of parameter entries. * @since v19.8.0 */ readonly size: number; /** Sort all key/value pairs contained in this object in place and * return undefined. The sort order is according to Unicode code * points of the keys. * * ```ts * searchParams.sort(); * ``` */ sort(): void; /** Calls a function for each element contained in this object in * place and return undefined. Optionally accepts an object to use * as this when executing callback as second argument. * * ```ts * const params = new URLSearchParams([["a", "b"], ["c", "d"]]); * params.forEach((value, key, parent) => { * console.log(value, key, parent); * }); * ``` */ forEach( callbackfn: (value: string, key: string, parent: this) => void, thisArg?: any, ): void; /** Returns an iterator allowing to go through all keys contained * in this object. * * ```ts * const params = new URLSearchParams([["a", "b"], ["c", "d"]]); * for (const key of params.keys()) { * console.log(key); * } * ``` */ keys(): IterableIterator; /** Returns an iterator allowing to go through all values contained * in this object. * * ```ts * const params = new URLSearchParams([["a", "b"], ["c", "d"]]); * for (const value of params.values()) { * console.log(value); * } * ``` */ values(): IterableIterator; /** Returns an iterator allowing to go through all key/value * pairs contained in this object. * * ```ts * const params = new URLSearchParams([["a", "b"], ["c", "d"]]); * for (const [key, value] of params.entries()) { * console.log(key, value); * } * ``` */ entries(): IterableIterator<[string, string]>; /** Returns an iterator allowing to go through all key/value * pairs contained in this object. * * ```ts * const params = new URLSearchParams([["a", "b"], ["c", "d"]]); * for (const [key, value] of params) { * console.log(key, value); * } * ``` */ [Symbol.iterator](): IterableIterator<[string, string]>; /** Returns a query string suitable for use in a URL. * * ```ts * searchParams.toString(); * ``` */ toString(): string; } /** The URL interface represents an object providing static methods used for creating object URLs. */ declare class URL { constructor(url: string, base?: string | URL); static createObjectURL(blob: Blob): string; static revokeObjectURL(url: string): void; hash: string; host: string; hostname: string; href: string; toString(): string; readonly origin: string; password: string; pathname: string; port: string; protocol: string; search: string; readonly searchParams: URLSearchParams; username: string; toJSON(): string; } // declare interface URLPatternInit { // protocol?: string; // username?: string; // password?: string; // hostname?: string; // port?: string; // pathname?: string; // search?: string; // hash?: string; // baseURL?: string; // } // declare type URLPatternInput = string | URLPatternInit; // declare interface URLPatternComponentResult { // input: string; // groups: Record; // } // /** `URLPatternResult` is the object returned from `URLPattern.exec`. */ // declare interface URLPatternResult { // /** The inputs provided when matching. */ // inputs: [URLPatternInit] | [URLPatternInit, string]; // /** The matched result for the `protocol` matcher. */ // protocol: URLPatternComponentResult; // /** The matched result for the `username` matcher. */ // username: URLPatternComponentResult; // /** The matched result for the `password` matcher. */ // password: URLPatternComponentResult; // /** The matched result for the `hostname` matcher. */ // hostname: URLPatternComponentResult; // /** The matched result for the `port` matcher. */ // port: URLPatternComponentResult; // /** The matched result for the `pathname` matcher. */ // pathname: URLPatternComponentResult; // /** The matched result for the `search` matcher. */ // search: URLPatternComponentResult; // /** The matched result for the `hash` matcher. */ // hash: URLPatternComponentResult; // } // /** // * The URLPattern API provides a web platform primitive for matching URLs based // * on a convenient pattern syntax. // * // * The syntax is based on path-to-regexp. Wildcards, named capture groups, // * regular groups, and group modifiers are all supported. // * // * ```ts // * // Specify the pattern as structured data. // * const pattern = new URLPattern({ pathname: "/users/:user" }); // * const match = pattern.exec("/users/joe"); // * console.log(match.pathname.groups.user); // joe // * ``` // * // * ```ts // * // Specify a fully qualified string pattern. // * const pattern = new URLPattern("https://example.com/books/:id"); // * console.log(pattern.test("https://example.com/books/123")); // true // * console.log(pattern.test("https://deno.land/books/123")); // false // * ``` // * // * ```ts // * // Specify a relative string pattern with a base URL. // * const pattern = new URLPattern("/:article", "https://blog.example.com"); // * console.log(pattern.test("https://blog.example.com/article")); // true // * console.log(pattern.test("https://blog.example.com/article/123")); // false // * ``` // */ // declare class URLPattern { // constructor(input: URLPatternInput, baseURL?: string); // /** // * Test if the given input matches the stored pattern. // * // * The input can either be provided as a url string (with an optional base), // * or as individual components in the form of an object. // * // * ```ts // * const pattern = new URLPattern("https://example.com/books/:id"); // * // * // Test a url string. // * console.log(pattern.test("https://example.com/books/123")); // true // * // * // Test a relative url with a base. // * console.log(pattern.test("/books/123", "https://example.com")); // true // * // * // Test an object of url components. // * console.log(pattern.test({ pathname: "/books/123" })); // true // * ``` // */ // test(input: URLPatternInput, baseURL?: string): boolean; // /** // * Match the given input against the stored pattern. // * // * The input can either be provided as a url string (with an optional base), // * or as individual components in the form of an object. // * // * ```ts // * const pattern = new URLPattern("https://example.com/books/:id"); // * // * // Match a url string. // * let match = pattern.exec("https://example.com/books/123"); // * console.log(match.pathname.groups.id); // 123 // * // * // Match a relative url with a base. // * match = pattern.exec("/books/123", "https://example.com"); // * console.log(match.pathname.groups.id); // 123 // * // * // Match an object of url components. // * match = pattern.exec({ pathname: "/books/123" }); // * console.log(match.pathname.groups.id); // 123 // * ``` // */ // exec(input: URLPatternInput, baseURL?: string): URLPatternResult | null; // /** The pattern string for the `protocol`. */ // readonly protocol: string; // /** The pattern string for the `username`. */ // readonly username: string; // /** The pattern string for the `password`. */ // readonly password: string; // /** The pattern string for the `hostname`. */ // readonly hostname: string; // /** The pattern string for the `port`. */ // readonly port: string; // /** The pattern string for the `pathname`. */ // readonly pathname: string; // /** The pattern string for the `search`. */ // readonly search: string; // /** The pattern string for the `hash`. */ // readonly hash: string; // } declare class DOMException extends Error { constructor(message?: string, name?: string); readonly name: string; readonly message: string; readonly code: number; } interface EventInit { bubbles?: boolean; cancelable?: boolean; composed?: boolean; } /** An event which takes place in the DOM. */ declare class Event { constructor(type: string, eventInitDict?: EventInit); /** Returns true or false depending on how event was initialized. True if * event goes through its target's ancestors in reverse tree order, and * false otherwise. */ readonly bubbles: boolean; cancelBubble: boolean; /** Returns true or false depending on how event was initialized. Its return * value does not always carry meaning, but true can indicate that part of the * operation during which event was dispatched, can be canceled by invoking * the preventDefault() method. */ readonly cancelable: boolean; /** Returns true or false depending on how event was initialized. True if * event invokes listeners past a ShadowRoot node that is the root of its * target, and false otherwise. */ readonly composed: boolean; /** Returns the object whose event listener's callback is currently being * invoked. */ readonly currentTarget: EventTarget | null; /** Returns true if preventDefault() was invoked successfully to indicate * cancellation, and false otherwise. */ readonly defaultPrevented: boolean; /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, * AT_TARGET, and BUBBLING_PHASE. */ readonly eventPhase: number; /** Returns true if event was dispatched by the user agent, and false * otherwise. */ readonly isTrusted: boolean; /** Returns the object to which event is dispatched (its target). */ readonly target: EventTarget | null; /** Returns the event's timestamp as the number of milliseconds measured * relative to the time origin. */ readonly timeStamp: number; /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ readonly type: string; /** Returns the invocation target objects of event's path (objects on which * listeners will be invoked), except for any nodes in shadow trees of which * the shadow root's mode is "closed" that are not reachable from event's * currentTarget. */ composedPath(): EventTarget[]; /** If invoked when the cancelable attribute value is true, and while * executing a listener for the event with passive set to false, signals to * the operation that caused event to be dispatched that it needs to be * canceled. */ preventDefault(): void; /** Invoking this method prevents event from reaching any registered event * listeners after the current one finishes running and, when dispatched in a * tree, also prevents event from reaching any other objects. */ stopImmediatePropagation(): void; /** When dispatched in a tree, invoking this method prevents event from * reaching any objects other than the current object. */ stopPropagation(): void; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; readonly NONE: number; static readonly AT_TARGET: number; static readonly BUBBLING_PHASE: number; static readonly CAPTURING_PHASE: number; static readonly NONE: number; } /** * EventTarget is a DOM interface implemented by objects that can receive events * and may have listeners for them. */ declare class EventTarget { /** Appends an event listener for events whose type attribute value is type. * The callback argument sets the callback that will be invoked when the event * is dispatched. * * The options argument sets listener-specific options. For compatibility this * can be a boolean, in which case the method behaves exactly as if the value * was specified as options's capture. * * When set to true, options's capture prevents callback from being invoked * when the event's eventPhase attribute value is BUBBLING_PHASE. When false * (or not present), callback will not be invoked when event's eventPhase * attribute value is CAPTURING_PHASE. Either way, callback will be invoked if * event's eventPhase attribute value is AT_TARGET. * * When set to true, options's passive indicates that the callback will not * cancel the event by invoking preventDefault(). This is used to enable * performance optimizations described in ยง 2.8 Observing event listeners. * * When set to true, options's once indicates that the callback will only be * invoked once after which the event listener will be removed. * * The event listener is appended to target's event listener list and is not * appended if it has the same type, callback, and capture. */ addEventListener( type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions, ): void; /** Dispatches a synthetic event event to target and returns true if either * event's cancelable attribute value is false or its preventDefault() method * was not invoked, and false otherwise. */ dispatchEvent(event: Event): boolean; /** Removes the event listener in target's event listener list with the same * type, callback, and options. */ removeEventListener( type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean, ): void; } interface EventListener { (evt: Event): void | Promise; } interface EventListenerObject { handleEvent(evt: Event): void | Promise; } declare type EventListenerOrEventListenerObject = | EventListener | EventListenerObject; interface AddEventListenerOptions extends EventListenerOptions { once?: boolean; passive?: boolean; } interface EventListenerOptions { capture?: boolean; } interface ProgressEventInit extends EventInit { lengthComputable?: boolean; loaded?: number; total?: number; } /** Events measuring progress of an underlying process, like an HTTP request * (for an XMLHttpRequest, or the loading of the underlying resource of an * ,