/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /// /** * The URL interface represents an object providing static methods used for creating object URLs. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL) */ interface URL { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hash) */ hash: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/host) */ host: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/hostname) */ hostname: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/href) */ href: string; toString(): string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/origin) */ readonly origin: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/password) */ password: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/pathname) */ pathname: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/port) */ port: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/protocol) */ protocol: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/search) */ search: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/searchParams) */ readonly searchParams: URLSearchParams; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/username) */ username: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/toJSON) */ toJSON(): string; } declare var URL: { prototype: URL; new (url: string | URL, base?: string | URL): URL; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */ canParse(url: string | URL, base?: string): boolean; }; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */ interface URLSearchParams { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */ readonly size: number; /** * Appends a specified key/value pair as a new search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append) */ append(name: string, value: string): void; /** * Deletes the given search parameter, and its associated value, from the list of all search parameters. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete) */ delete(name: string, value?: string): void; /** * Returns the first value associated to the given search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get) */ get(name: string): string | null; /** * Returns all the values association with a given search parameter. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll) */ getAll(name: string): string[]; /** * Returns a Boolean indicating if such a search parameter exists. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has) */ has(name: string, value?: string): boolean; /** * Sets the value associated to a given search parameter to the given value. If there were several values, delete the others. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set) */ set(name: string, value: string): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */ sort(): void; /** Returns a string containing a query string suitable for use in a URL. Does not include the question mark. */ toString(): string; forEach( callbackfn: (value: string, key: string, parent: URLSearchParams) => void, thisArg?: any ): void; } declare var URLSearchParams: { prototype: URLSearchParams; new ( init?: string[][] | Record | string | URLSearchParams ): URLSearchParams; }; interface TextDecodeOptions { stream?: boolean; } interface TextDecoderOptions { fatal?: boolean; ignoreBOM?: boolean; } interface TextEncoderEncodeIntoResult { read: number; written: number; } type AllowSharedBufferSource = ArrayBuffer | ArrayBufferView; /** * A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder) */ interface TextDecoder extends TextDecoderCommon { /** * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments. * * ``` * var string = "", decoder = new TextDecoder(encoding), buffer; * while(buffer = next_chunk()) { * string += decoder.decode(buffer, {stream:true}); * } * string += decoder.decode(); // end-of-queue * ``` * * If the error mode is "fatal" and encoding's decoder returns error, throws a TypeError. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/decode) */ decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string; } declare var TextDecoder: { prototype: TextDecoder; new (label?: string, options?: TextDecoderOptions): TextDecoder; }; interface TextDecoderCommon { /** * Returns encoding's name, lowercased. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/encoding) */ readonly encoding: string; /** * Returns true if error mode is "fatal", otherwise false. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/fatal) */ readonly fatal: boolean; /** * Returns the value of ignore BOM. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder/ignoreBOM) */ readonly ignoreBOM: boolean; } /** * TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder) */ interface TextEncoder extends TextEncoderCommon { /** * Returns the result of running UTF-8's encoder. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encode) */ encode(input?: string): Uint8Array; /** * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as an object wherein read is the number of converted code units of source and written is the number of bytes modified in destination. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encodeInto) */ encodeInto( source: string, destination: Uint8Array ): TextEncoderEncodeIntoResult; } declare var TextEncoder: { prototype: TextEncoder; new (): TextEncoder; }; interface TextEncoderCommon { /** * Returns "utf-8". * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextEncoder/encoding) */ readonly encoding: string; } /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */ interface Console { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug_static) */ debug(...data: any[]): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error_static) */ error(...data: any[]): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info_static) */ info(...data: any[]): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) */ log(...data: any[]): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn_static) */ warn(...data: any[]): void; } declare var console: Console;