Skip to content

Commit

Permalink
Reformatted Bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Redfire75369 committed Oct 30, 2023
1 parent 5d50b42 commit f322aa8
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 93 deletions.
12 changes: 12 additions & 0 deletions bindings/globals/flow/console.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,39 @@

interface Console {
log(...values: any[]): void;

info(...values: any[]): void;

dir(...values: any[]): void;

dirxml(...values: any[]): void,

warn(...values: any[]): void;

error(...values: any[]): void;

debug(...values: any[]): void;

assert(assertion: boolean, ...values: any[]): void;

clear(): void;

trace(...values: any[]): void;

group(...values: any[]): void;

groupCollapsed(...values: any[]): void;

groupEnd(): void;

count(label?: string): void;

countReset(label?: string): void;

time(label?: string): void;

timeLog(label?: string, ...values: any[]): void;

timeEnd(label?: string): void;

table(data: any, columns?: string[]): void;
Expand Down
2 changes: 2 additions & 0 deletions bindings/globals/flow/timers.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

// TODO: Improve Typing for Arguments
declare function setTimeout<T>(callback: (...arguments: T[]) => void, duration?: number, ...arguments: T[]): number;

declare function setInterval<T>(callback: (...arguments: T[]) => void, duration?: number, ...arguments: T[]): number;

declare function clearTimeout(id: number): void;

declare function clearInterval(id: number): void;

declare function queueMacrotask(callback: () => void): void;
9 changes: 6 additions & 3 deletions bindings/globals/typescript/abort.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ declare class AbortController {
constructor();

get signal(): AbortSignal;

abort(reason?: any): void;
}

declare class AbortSignal {
static abort(reason?: any): AbortSignal;
static timeout(time: number): AbortSignal;

get aborted(): boolean;

get reason(): any;

static abort(reason?: any): AbortSignal;

static timeout(time: number): AbortSignal;

throwIfAborted(): void;
}
12 changes: 12 additions & 0 deletions bindings/globals/typescript/console.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
declare namespace console {
function log(...values: any[]): void;

function info(...values: any[]): void;

function dir(...values: any[]): void;

function dirxml(...values: any[]): void;

function warn(...values: any[]): void;

function error(...values: any[]): void;

function debug(...values: any[]): void;

function assert(assertion: boolean, ...values: any[]): void;

function clear(): void;

function trace(...values: any[]): void;

function group(...values: any[]): void;

function groupCollapsed(...values: any[]): void;

function groupEnd(): void;

function count(label?: string): void;

function countReset(label?: string): void;

function time(label?: string): void;

function timeLog(label?: string, ...values: any[]): void;

function timeEnd(label?: string): void;

function table(data: any, columns?: string[]): void;
Expand Down
3 changes: 3 additions & 0 deletions bindings/globals/typescript/encoding.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ declare class TextDecoder {
constructor(label?: string, options?: DecoderOptions);

get encoding(): string;

get fatal(): boolean;

get ignoreBOM(): boolean;

decode(buffer: BufferSource, options?: DecodeOptions): string;
Expand All @@ -26,5 +28,6 @@ declare class TextEncoder {
get encoding(): string;

encode(input?: string): Uint8Array;

encodeInto(source: string, destination: Uint8Array): EncodeResult;
}
186 changes: 103 additions & 83 deletions bindings/globals/typescript/fetch.d.ts
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@
declare type HeadersInit = Headers | [string, string][] | Record<string, string>;

declare class Headers implements Iterable<[string, string]> {
constructor(init?: HeadersInit);
constructor(init?: HeadersInit);

append(name: string, value: string): void;
delete(name: string): void;
get(name: string): string | null;
getSetCookie(): string[];
has(name: string): boolean;
set(name: string, value: string): void;
append(name: string, value: string): void;

[Symbol.iterator](): Iterator<[string, string]>;
delete(name: string): void;

get(name: string): string | null;

getSetCookie(): string[];

has(name: string): boolean;

set(name: string, value: string): void;

[Symbol.iterator](): Iterator<[string, string]>;
}

declare type BodyInit = BufferSource | string;

declare type RequestInfo = Request | string;

declare type RequestDestination =
""
| "audio"
| "audioworklet"
| "document"
| "embed"
| "font"
| "frame"
| "iframe"
| "image"
| "manifest"
| "object"
| "paintworklet"
| "report"
| "script"
| "sharedworker"
| "style"
| "track"
| "video"
| "worker"
| "xslt";
""
| "audio"
| "audioworklet"
| "document"
| "embed"
| "font"
| "frame"
| "iframe"
| "image"
| "manifest"
| "object"
| "paintworklet"
| "report"
| "script"
| "sharedworker"
| "style"
| "track"
| "video"
| "worker"
| "xslt";

declare type ReferrerPolicy =
""
| "no-referrer"
| "no-referrer-when-downgrade"
| "same-origin"
| "origin"
| "strict-origin"
| "origin-when-cross-origin"
| "strict-origin-when-cross-origin"
| "unsafe-url";
""
| "no-referrer"
| "no-referrer-when-downgrade"
| "same-origin"
| "origin"
| "strict-origin"
| "origin-when-cross-origin"
| "strict-origin-when-cross-origin"
| "unsafe-url";

declare type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors";

Expand All @@ -63,78 +68,93 @@ declare type RequestDuplex = "half";
declare type RequestPriority = "high" | "low" | "auto";

declare interface RequestInit {
method?: string;
headers?: HeadersInit;
body?: BodyInit;
method?: string;
headers?: HeadersInit;
body?: BodyInit;

referrer?: string;
referrerPolicy?: ReferrerPolicy;
referrer?: string;
referrerPolicy?: ReferrerPolicy;

mode?: RequestMode;
credentials?: RequestCredentials;
cache?: RequestCache;
redirect?: RequestRedirect;
mode?: RequestMode;
credentials?: RequestCredentials;
cache?: RequestCache;
redirect?: RequestRedirect;

integrity?: string;
keepalive?: boolean;
signal?: AbortSignal;
integrity?: string;
keepalive?: boolean;
signal?: AbortSignal;

duplex?: RequestDuplex;
priority?: RequestPriority;
window?: null;
duplex?: RequestDuplex;
priority?: RequestPriority;
window?: null;
}

declare class Request {
constructor(input: RequestInfo, init?: RequestInit);
constructor(input: RequestInfo, init?: RequestInit);

get method(): string;

get url(): string;

get headers(): Headers;

get destination(): RequestDestination;

get referrer(): string;

get method(): string;
get url(): string;
get headers(): Headers;
get referrerPolicy(): ReferrerPolicy;

get destination(): RequestDestination;
get referrer(): string;
get referrerPolicy(): ReferrerPolicy;
get mode(): RequestMode;

get mode(): RequestMode;
get credentials(): RequestCredentials;
get cache(): RequestCache;
get redirect(): RequestRedirect;
get credentials(): RequestCredentials;

get integrity(): string;
get keepalive(): boolean;
get cache(): RequestCache;

get isReloadNavigation(): string;
get isHistoryNavigation(): string;
get redirect(): RequestRedirect;

get signal(): AbortSignal;
get duplex(): RequestDuplex;
get integrity(): string;

get keepalive(): boolean;

get isReloadNavigation(): string;

get isHistoryNavigation(): string;

get signal(): AbortSignal;

get duplex(): RequestDuplex;
}

declare interface ResponseInit {
status?: number;
statusText?: string;
headers?: HeadersInit;
status?: number;
statusText?: string;
headers?: HeadersInit;
}

declare type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect";

declare class Response {
constructor(body?: BodyInit, init?: ResponseInit);
constructor(body?: BodyInit, init?: ResponseInit);

get type(): ResponseType;

get url(): string;

get redirected(): boolean;

get status(): number;

get ok(): boolean;

get type(): ResponseType;
get statusText(): string;

get url(): string;
get redirected(): boolean;
get headers(): Headers;

get status(): number;
get ok(): boolean;
get statusText(): string;
get bodyUsed(): boolean;

get headers(): Headers;
arrayBuffer(): Promise<ArrayBuffer>;

get bodyUsed(): boolean;
arrayBuffer(): Promise<ArrayBuffer>;
text(): Promise<string>;
text(): Promise<string>;
}

declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
2 changes: 2 additions & 0 deletions bindings/globals/typescript/timers.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
declare function setTimeout<T extends any[]>(callback: (...arguments: [...T]) => void, duration?: number, ...arguments: [...T]): number;

declare function setInterval<T extends any[]>(callback: (...arguments: [...T]) => void, duration?: number, ...arguments: [...T]): number;

declare function clearTimeout(id: number): void;

declare function clearInterval(id: number): void;

declare function queueMacrotask(callback: () => void): void;
Loading

0 comments on commit f322aa8

Please sign in to comment.