Skip to content

Add abortable fetch interfaces #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ interface RegistrationOptions {
}

interface RequestInit {
signal?: AbortSignal;
body?: any;
cache?: RequestCache;
credentials?: RequestCredentials;
Expand Down Expand Up @@ -9233,6 +9234,7 @@ interface Request extends Object, Body {
readonly referrerPolicy: ReferrerPolicy;
readonly type: RequestType;
readonly url: string;
readonly signal: AbortSignal;
clone(): Request;
}

Expand Down Expand Up @@ -14785,6 +14787,21 @@ interface WEBGL_lose_context {
restoreContext(): void;
}

interface AbortController {
readonly signal: AbortSignal;
abort(): void;
}

declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};

interface AbortSignal extends EventTarget {
readonly aborted: boolean;
onabort: (ev: Event) => any;
}

declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;

interface DecodeErrorCallback {
Expand Down Expand Up @@ -15365,4 +15382,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated
type Transport = "usb" | "nfc" | "ble";
type VideoFacingModeEnum = "user" | "environment" | "left" | "right";
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
19 changes: 18 additions & 1 deletion baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ interface PushSubscriptionOptionsInit {
}

interface RequestInit {
signal?: AbortSignal;
body?: any;
cache?: RequestCache;
credentials?: RequestCredentials;
Expand Down Expand Up @@ -960,6 +961,7 @@ interface Request extends Object, Body {
readonly referrerPolicy: ReferrerPolicy;
readonly type: RequestType;
readonly url: string;
readonly signal: AbortSignal;
clone(): Request;
}

Expand Down Expand Up @@ -1822,6 +1824,21 @@ interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
}

interface AbortController {
readonly signal: AbortSignal;
abort(): void;
}

declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};

interface AbortSignal extends EventTarget {
readonly aborted: boolean;
onabort: (ev: Event) => any;
}

declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;

interface DecodeErrorCallback {
Expand Down Expand Up @@ -1912,4 +1929,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
type ClientType = "window" | "worker" | "sharedworker" | "all";
type FrameType = "auxiliary" | "top-level" | "nested" | "none";
type FrameType = "auxiliary" | "top-level" | "nested" | "none";
53 changes: 52 additions & 1 deletion inputfiles/addedTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2488,5 +2488,56 @@
"readonly": true,
"name": "lastModified",
"type": "number"
},
{
"kind": "interface",
"name": "AbortController",
"constructorSignatures": [
"new(): AbortController"
],
"properties": [
{
"readonly": true,
"name": "signal",
"type": "AbortSignal"
}
],
"methods": [
{
"name": "abort",
"signatures": [
"abort(): void"
]
}
]
},
{
"kind": "interface",
"name": "AbortSignal",
"extends": "EventTarget",
"properties": [
{
"readonly": true,
"name": "aborted",
"type": "boolean"
},
{
"name": "onabort",
"type": "(ev: Event) => any"
}
]
},
{
"kind": "property",
"interface": "Request",
"readonly": true,
"name": "signal",
"type": "AbortSignal"
},
{
"kind": "property",
"interface": "RequestInit",
"name": "signal?",
"type": "AbortSignal"
}
]
]