Remove __textEncoding and __performanceUtil namespaces (#4663)

This commit is contained in:
Ryan Dahl 2020-04-07 13:27:37 -04:00 committed by GitHub
parent caff550b6c
commit 51f5276e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,8 +13,6 @@
declare interface WindowOrWorkerGlobalScope {
// methods
atob: typeof __textEncoding.atob;
btoa: typeof __textEncoding.btoa;
fetch: typeof __fetch.fetch;
// properties
console: __console.Console;
@ -27,12 +25,9 @@ declare interface WindowOrWorkerGlobalScope {
URLSearchParams: typeof __urlSearchParams.URLSearchParams;
Headers: __domTypes.HeadersConstructor;
FormData: __domTypes.FormDataConstructor;
TextEncoder: typeof __textEncoding.TextEncoder;
TextDecoder: typeof __textEncoding.TextDecoder;
ReadableStream: __domTypes.ReadableStreamConstructor;
Request: __domTypes.RequestConstructor;
Response: typeof __fetch.Response;
performance: __performanceUtil.Performance;
Worker: typeof __workers.WorkerImpl;
location: __domTypes.Location;
@ -221,8 +216,6 @@ declare namespace WebAssembly {
}
}
declare const atob: typeof __textEncoding.atob;
declare const btoa: typeof __textEncoding.btoa;
declare const fetch: typeof __fetch.fetch;
/** Sets a timer which executes a function once after the timer expires. */
@ -255,12 +248,9 @@ declare const URLSearchParams: typeof __urlSearchParams.URLSearchParams;
declare const Headers: __domTypes.HeadersConstructor;
declare const location: __domTypes.Location;
declare const FormData: __domTypes.FormDataConstructor;
declare const TextEncoder: typeof __textEncoding.TextEncoder;
declare const TextDecoder: typeof __textEncoding.TextDecoder;
declare const ReadableStream: __domTypes.ReadableStreamConstructor;
declare const Request: __domTypes.RequestConstructor;
declare const Response: typeof __fetch.Response;
declare const performance: __performanceUtil.Performance;
declare const Worker: typeof __workers.WorkerImpl;
declare const addEventListener: (
@ -288,8 +278,6 @@ declare type URL = __url.URL;
declare type URLSearchParams = __domTypes.URLSearchParams;
declare type Headers = __domTypes.Headers;
declare type FormData = __domTypes.FormData;
declare type TextEncoder = __textEncoding.TextEncoder;
declare type TextDecoder = __textEncoding.TextDecoder;
declare type ReadableStream<R = any> = __domTypes.ReadableStream<R>;
declare type Request = __domTypes.Request;
declare type Response = __domTypes.Response;
@ -1366,44 +1354,37 @@ declare namespace __fetch {
): Promise<Response>;
}
declare namespace __textEncoding {
export function atob(s: string): string;
/** Creates a base-64 ASCII string from the input string. */
export function btoa(s: string): string;
export interface TextDecodeOptions {
stream?: false;
}
export interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
export class TextDecoder {
/** Returns encoding's name, lowercased. */
readonly encoding: string;
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
readonly fatal: boolean;
/** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
readonly ignoreBOM = false;
constructor(label?: string, options?: TextDecoderOptions);
/** Returns the result of running encoding's decoder. */
decode(
input?: __domTypes.BufferSource,
options?: TextDecodeOptions
): string;
readonly [Symbol.toStringTag]: string;
}
interface TextEncoderEncodeIntoResult {
read: number;
written: number;
}
export class TextEncoder {
/** Returns "utf-8". */
readonly encoding = "utf-8";
/** Returns the result of running UTF-8's encoder. */
encode(input?: string): Uint8Array;
encodeInto(input: string, dest: Uint8Array): TextEncoderEncodeIntoResult;
readonly [Symbol.toStringTag]: string;
}
declare function atob(s: string): string;
/** Creates a base-64 ASCII string from the input string. */
declare function btoa(s: string): string;
declare class TextDecoder {
/** Returns encoding's name, lowercased. */
readonly encoding: string;
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
readonly fatal: boolean;
/** Returns `true` if ignore BOM flag is set, and `false` otherwise. */
readonly ignoreBOM = false;
constructor(
label?: string,
options?: { fatal?: boolean; ignoreBOM?: boolean }
);
/** Returns the result of running encoding's decoder. */
decode(input?: __domTypes.BufferSource, options?: { stream?: false }): string;
readonly [Symbol.toStringTag]: string;
}
declare class TextEncoder {
/** Returns "utf-8". */
readonly encoding = "utf-8";
/** Returns the result of running UTF-8's encoder. */
encode(input?: string): Uint8Array;
encodeInto(
input: string,
dest: Uint8Array
): { read: number; written: number };
readonly [Symbol.toStringTag]: string;
}
declare namespace __urlSearchParams {
@ -1554,17 +1535,15 @@ declare namespace __workers {
}
}
declare namespace __performanceUtil {
export class Performance {
/** Returns a current time from Deno's start in milliseconds.
*
* Use the flag --allow-hrtime return a precise value.
*
* const t = performance.now();
* console.log(`${t} ms since start!`);
*/
now(): number;
}
declare namespace performance {
/** Returns a current time from Deno's start in milliseconds.
*
* Use the flag --allow-hrtime return a precise value.
*
* const t = performance.now();
* console.log(`${t} ms since start!`);
*/
export function now(): number;
}
/* eslint-enable @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any */