summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno.shared_globals.d.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-29 04:03:49 +1100
committerGitHub <noreply@github.com>2020-03-28 13:03:49 -0400
commitbced52505f32d6cca4f944bb610a8a26767908a8 (patch)
treeda49a5df4b7bd6f8306248069228cd6bd0db1303 /cli/js/lib.deno.shared_globals.d.ts
parent1397b8e0e7c85762e19d88fde103342bfa563360 (diff)
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'cli/js/lib.deno.shared_globals.d.ts')
-rw-r--r--cli/js/lib.deno.shared_globals.d.ts224
1 files changed, 135 insertions, 89 deletions
diff --git a/cli/js/lib.deno.shared_globals.d.ts b/cli/js/lib.deno.shared_globals.d.ts
index 959dcbfe9..565121bea 100644
--- a/cli/js/lib.deno.shared_globals.d.ts
+++ b/cli/js/lib.deno.shared_globals.d.ts
@@ -339,12 +339,8 @@ declare namespace __domTypes {
export enum NodeType {
ELEMENT_NODE = 1,
TEXT_NODE = 3,
- DOCUMENT_FRAGMENT_NODE = 11
+ DOCUMENT_FRAGMENT_NODE = 11,
}
- export const eventTargetHost: unique symbol;
- export const eventTargetListeners: unique symbol;
- export const eventTargetMode: unique symbol;
- export const eventTargetNodeType: unique symbol;
export interface EventListener {
(evt: Event): void | Promise<void>;
}
@@ -358,11 +354,11 @@ declare namespace __domTypes {
callback: EventListenerOrEventListenerObject;
options: AddEventListenerOptions;
}
+ export const eventTargetHost: unique symbol;
+ export const eventTargetListeners: unique symbol;
+ export const eventTargetMode: unique symbol;
+ export const eventTargetNodeType: unique symbol;
export interface EventTarget {
- [eventTargetHost]: EventTarget | null;
- [eventTargetListeners]: { [type in string]: EventListener[] };
- [eventTargetMode]: string;
- [eventTargetNodeType]: NodeType;
addEventListener(
type: string,
callback: EventListenerOrEventListenerObject | null,
@@ -438,7 +434,7 @@ declare namespace __domTypes {
NONE = 0,
CAPTURING_PHASE = 1,
AT_TARGET = 2,
- BUBBLING_PHASE = 3
+ BUBBLING_PHASE = 3,
}
export interface EventPath {
item: EventTarget;
@@ -532,16 +528,78 @@ declare namespace __domTypes {
options?: boolean | EventListenerOptions
): void;
}
- export interface ReadableStream {
+ export interface ReadableStreamReadDoneResult<T> {
+ done: true;
+ value?: T;
+ }
+ export interface ReadableStreamReadValueResult<T> {
+ done: false;
+ value: T;
+ }
+ export type ReadableStreamReadResult<T> =
+ | ReadableStreamReadValueResult<T>
+ | ReadableStreamReadDoneResult<T>;
+ export interface ReadableStreamDefaultReader<R = any> {
+ readonly closed: Promise<void>;
+ cancel(reason?: any): Promise<void>;
+ read(): Promise<ReadableStreamReadResult<R>>;
+ releaseLock(): void;
+ }
+ export interface PipeOptions {
+ preventAbort?: boolean;
+ preventCancel?: boolean;
+ preventClose?: boolean;
+ signal?: AbortSignal;
+ }
+ /** This Streams API interface represents a readable stream of byte data. The
+ * Fetch API offers a concrete instance of a ReadableStream through the body
+ * property of a Response object. */
+ export interface ReadableStream<R = any> {
readonly locked: boolean;
- cancel(): Promise<void>;
- getReader(): ReadableStreamReader;
- tee(): [ReadableStream, ReadableStream];
+ cancel(reason?: any): Promise<void>;
+ getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
+ getReader(): ReadableStreamDefaultReader<R>;
+ /* disabled for now
+ pipeThrough<T>(
+ {
+ writable,
+ readable
+ }: {
+ writable: WritableStream<R>;
+ readable: ReadableStream<T>;
+ },
+ options?: PipeOptions
+ ): ReadableStream<T>;
+ pipeTo(dest: WritableStream<R>, options?: PipeOptions): Promise<void>;
+ */
+ tee(): [ReadableStream<R>, ReadableStream<R>];
+ }
+ export interface ReadableStreamReader<R = any> {
+ cancel(reason: any): Promise<void>;
+ read(): Promise<ReadableStreamReadResult<R>>;
+ releaseLock(): void;
}
- export interface ReadableStreamReader {
- cancel(): Promise<void>;
- read(): Promise<any>;
+ export interface ReadableStreamBYOBReader {
+ readonly closed: Promise<void>;
+ cancel(reason?: any): Promise<void>;
+ read<T extends ArrayBufferView>(
+ view: T
+ ): Promise<ReadableStreamReadResult<T>>;
+ releaseLock(): void;
+ }
+ export interface WritableStream<W = any> {
+ readonly locked: boolean;
+ abort(reason?: any): Promise<void>;
+ getWriter(): WritableStreamDefaultWriter<W>;
+ }
+ export interface WritableStreamDefaultWriter<W = any> {
+ readonly closed: Promise<void>;
+ readonly desiredSize: number | null;
+ readonly ready: Promise<void>;
+ abort(reason?: any): Promise<void>;
+ close(): Promise<void>;
releaseLock(): void;
+ write(chunk: W): Promise<void>;
}
export interface FormData extends DomIterable<string, FormDataEntryValue> {
append(name: string, value: string | Blob, fileName?: string): void;
@@ -570,7 +628,7 @@ declare namespace __domTypes {
}
export interface Body {
/** A simple getter used to expose a `ReadableStream` of the body contents. */
- readonly body: ReadableStream | null;
+ readonly body: ReadableStream<Uint8Array> | null;
/** Stores a `Boolean` that declares whether the body has been used in a
* response yet.
*/
@@ -799,58 +857,63 @@ declare namespace __domTypes {
/** Creates a clone of a `Response` object. */
clone(): Response;
}
+ export 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;
+ }
+ /** The location (URL) of the object it is linked to. Changes done on it are
+ * reflected on the object it relates to. Both the Document and Window
+ * interface have such a linked Location, accessible via Document.location and
+ * Window.location respectively. */
export 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.
- */
- readonly ancestorOrigins: string[];
- /**
- * Returns the Location object's URL's fragment (includes leading "#" if
+ /** Returns a DOMStringList object listing the origins of the ancestor
+ * browsing contexts, from the parent browsing context to the top-level
+ * browsing context. */
+ readonly ancestorOrigins: DOMStringList;
+ /** Returns the Location object's URL's fragment (includes leading "#" if
* non-empty).
+ *
* Can be set, to navigate to the same URL with a changed fragment (ignores
- * leading "#").
- */
+ * leading "#"). */
hash: string;
- /**
- * Returns the Location object's URL's host and port (if different from the
- * default port for the scheme). Can be set, to navigate to the same URL with
- * a changed host and port.
- */
+ /** Returns the Location object's URL's host and port (if different from the
+ * default port for the scheme).
+ *
+ * Can be set, to navigate to the same URL with a changed host and port. */
host: string;
- /**
- * Returns the Location object's URL's host. Can be set, to navigate to the
- * same URL with a changed host.
- */
+ /** Returns the Location object's URL's host.
+ *
+ * Can be set, to navigate to the same URL with a changed host. */
hostname: string;
- /**
- * Returns the Location object's URL. Can be set, to navigate to the given
- * URL.
- */
+ /** Returns the Location object's URL.
+ *
+ * Can be set, to navigate to the given URL. */
href: string;
+ toString(): string;
/** Returns the Location object's URL's origin. */
readonly origin: string;
- /**
- * Returns the Location object's URL's path.
- * Can be set, to navigate to the same URL with a changed path.
- */
+ /** Returns the Location object's URL's path.
+ *
+ * Can be set, to navigate to the same URL with a changed path. */
pathname: string;
- /**
- * Returns the Location object's URL's port.
- * Can be set, to navigate to the same URL with a changed port.
- */
+ /** Returns the Location object's URL's port.
+ *
+ * Can be set, to navigate to the same URL with a changed port. */
port: string;
- /**
- * Returns the Location object's URL's scheme.
- * Can be set, to navigate to the same URL with a changed scheme.
- */
+ /** Returns the Location object's URL's scheme.
+ *
+ * Can be set, to navigate to the same URL with a changed scheme. */
protocol: string;
- /**
- * Returns the Location object's URL's query (includes leading "?" if
- * non-empty). Can be set, to navigate to the same URL with a changed query
- * (ignores leading "?").
- */
+ /** Returns the Location object's URL's query (includes leading "?" if
+ * non-empty).
+ *
+ * Can be set, to navigate to the same URL with a changed query (ignores
+ * leading "?"). */
search: string;
/**
* Navigates to the given URL.
@@ -860,21 +923,14 @@ declare namespace __domTypes {
* Reloads the current page.
*/
reload(): void;
- /** @deprecated */
- reload(forcedReload: boolean): void;
- /**
- * Removes the current page from the session history and navigates to the
- * given URL.
- */
+ /** Removes the current page from the session history and navigates to the
+ * given URL. */
replace(url: string): void;
}
}
declare namespace __blob {
- export const bytesSymbol: unique symbol;
- export const blobBytesWeakMap: WeakMap<__domTypes.Blob, Uint8Array>;
export class DenoBlob implements __domTypes.Blob {
- private readonly [bytesSymbol];
readonly size: number;
readonly type: string;
/** A blob object represents a file-like object of immutable, raw data. */
@@ -899,7 +955,6 @@ declare namespace __console {
}
const isConsoleInstance: unique symbol;
export class Console {
- private printFunc;
indentLevel: number;
[isConsoleInstance]: boolean;
/** Writes the arguments to stdout */
@@ -982,7 +1037,7 @@ declare namespace __event {
constructor({
bubbles,
cancelable,
- composed
+ composed,
}?: {
bubbles?: boolean | undefined;
cancelable?: boolean | undefined;
@@ -1053,7 +1108,7 @@ declare namespace __customEvent {
bubbles,
cancelable,
composed,
- detail
+ detail,
}: __domTypes.CustomEventInit);
}
export class CustomEvent extends __event.Event
@@ -1083,7 +1138,7 @@ declare namespace __eventTarget {
constructor({
capture,
passive,
- once
+ once,
}?: {
capture?: boolean | undefined;
passive?: boolean | undefined;
@@ -1123,7 +1178,7 @@ declare namespace __io {
export enum SeekMode {
SEEK_START = 0,
SEEK_CURRENT = 1,
- SEEK_END = 2
+ SEEK_END = 2,
}
export interface Reader {
/** Reads up to p.byteLength bytes into `p`. It resolves to the number
@@ -1213,16 +1268,15 @@ declare namespace __io {
declare namespace __fetch {
class Body
- implements __domTypes.Body, __domTypes.ReadableStream, __io.ReadCloser {
- private rid;
+ implements
+ __domTypes.Body,
+ __domTypes.ReadableStream<Uint8Array>,
+ __io.ReadCloser {
readonly contentType: string;
bodyUsed: boolean;
- private _bodyPromise;
- private _data;
readonly locked: boolean;
- readonly body: null | Body;
+ readonly body: __domTypes.ReadableStream<Uint8Array>;
constructor(rid: number, contentType: string);
- private _bodyBuffer;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<__domTypes.Blob>;
formData(): Promise<__domTypes.FormData>;
@@ -1231,7 +1285,9 @@ declare namespace __fetch {
read(p: Uint8Array): Promise<number | Deno.EOF>;
close(): void;
cancel(): Promise<void>;
- getReader(): __domTypes.ReadableStreamReader;
+ getReader(options: { mode: "byob" }): __domTypes.ReadableStreamBYOBReader;
+ getReader(): __domTypes.ReadableStreamDefaultReader<Uint8Array>;
+ getReader(): __domTypes.ReadableStreamBYOBReader;
tee(): [__domTypes.ReadableStream, __domTypes.ReadableStream];
[Symbol.asyncIterator](): AsyncIterableIterator<Uint8Array>;
}
@@ -1283,7 +1339,6 @@ declare namespace __textEncoding {
ignoreBOM?: boolean;
}
export class TextDecoder {
- private _encoding;
/** Returns encoding's name, lowercased. */
readonly encoding: string;
/** Returns `true` if error mode is "fatal", and `false` otherwise. */
@@ -1333,10 +1388,7 @@ declare namespace __timers {
declare namespace __urlSearchParams {
export class URLSearchParams {
- private params;
- private url;
constructor(init?: string | string[][] | Record<string, string>);
- private updateSteps;
/** Appends a specified key/value pair as a new search parameter.
*
* searchParams.append('name', 'first');
@@ -1431,8 +1483,6 @@ declare namespace __urlSearchParams {
* searchParams.toString();
*/
toString(): string;
- private _handleStringInitialization;
- private _handleArrayInitialization;
}
}
@@ -1475,16 +1525,12 @@ declare namespace __workers {
name?: string;
}
export class WorkerImpl implements Worker {
- private readonly id;
- private isClosing;
- private readonly isClosedPromise;
onerror?: (e: Event) => void;
onmessage?: (data: any) => void;
onmessageerror?: () => void;
constructor(specifier: string, options?: WorkerOptions);
postMessage(data: any): void;
terminate(): void;
- private run;
}
}