Skip to content

Commit 2bc88ff

Browse files
committed
Add abortable fetch interfaces
1 parent a174e93 commit 2bc88ff

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed

baselines/dom.generated.d.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ interface RegistrationOptions {
770770
}
771771

772772
interface RequestInit {
773+
signal?: AbortSignal;
773774
body?: any;
774775
cache?: RequestCache;
775776
credentials?: RequestCredentials;
@@ -9233,6 +9234,7 @@ interface Request extends Object, Body {
92339234
readonly referrerPolicy: ReferrerPolicy;
92349235
readonly type: RequestType;
92359236
readonly url: string;
9237+
readonly signal: AbortSignal;
92369238
clone(): Request;
92379239
}
92389240

@@ -14785,6 +14787,21 @@ interface WEBGL_lose_context {
1478514787
restoreContext(): void;
1478614788
}
1478714789

14790+
interface AbortController {
14791+
readonly signal: AbortSignal;
14792+
abort(): void;
14793+
}
14794+
14795+
declare var AbortController: {
14796+
prototype: AbortController;
14797+
new(): AbortController;
14798+
};
14799+
14800+
interface AbortSignal extends EventTarget {
14801+
readonly aborted: boolean;
14802+
onabort: (ev: Event) => any;
14803+
}
14804+
1478814805
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
1478914806

1479014807
interface DecodeErrorCallback {
@@ -15365,4 +15382,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated
1536515382
type Transport = "usb" | "nfc" | "ble";
1536615383
type VideoFacingModeEnum = "user" | "environment" | "left" | "right";
1536715384
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
15368-
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
15385+
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";

baselines/webworker.generated.d.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ interface PushSubscriptionOptionsInit {
7171
}
7272

7373
interface RequestInit {
74+
signal?: AbortSignal;
7475
body?: any;
7576
cache?: RequestCache;
7677
credentials?: RequestCredentials;
@@ -960,6 +961,7 @@ interface Request extends Object, Body {
960961
readonly referrerPolicy: ReferrerPolicy;
961962
readonly type: RequestType;
962963
readonly url: string;
964+
readonly signal: AbortSignal;
963965
clone(): Request;
964966
}
965967

@@ -1822,6 +1824,21 @@ interface AddEventListenerOptions extends EventListenerOptions {
18221824
once?: boolean;
18231825
}
18241826

1827+
interface AbortController {
1828+
readonly signal: AbortSignal;
1829+
abort(): void;
1830+
}
1831+
1832+
declare var AbortController: {
1833+
prototype: AbortController;
1834+
new(): AbortController;
1835+
};
1836+
1837+
interface AbortSignal extends EventTarget {
1838+
readonly aborted: boolean;
1839+
onabort: (ev: Event) => any;
1840+
}
1841+
18251842
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
18261843

18271844
interface DecodeErrorCallback {
@@ -1912,4 +1929,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated
19121929
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
19131930
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
19141931
type ClientType = "window" | "worker" | "sharedworker" | "all";
1915-
type FrameType = "auxiliary" | "top-level" | "nested" | "none";
1932+
type FrameType = "auxiliary" | "top-level" | "nested" | "none";

inputfiles/addedTypes.json

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,5 +2488,56 @@
24882488
"readonly": true,
24892489
"name": "lastModified",
24902490
"type": "number"
2491+
},
2492+
{
2493+
"kind": "interface",
2494+
"name": "AbortController",
2495+
"constructorSignatures": [
2496+
"new(): AbortController"
2497+
],
2498+
"properties": [
2499+
{
2500+
"readonly": true,
2501+
"name": "signal",
2502+
"type": "AbortSignal"
2503+
}
2504+
],
2505+
"methods": [
2506+
{
2507+
"name": "abort",
2508+
"signatures": [
2509+
"abort(): void"
2510+
]
2511+
}
2512+
]
2513+
},
2514+
{
2515+
"kind": "interface",
2516+
"name": "AbortSignal",
2517+
"extends": "EventTarget",
2518+
"properties": [
2519+
{
2520+
"readonly": true,
2521+
"name": "aborted",
2522+
"type": "boolean"
2523+
},
2524+
{
2525+
"name": "onabort",
2526+
"type": "(ev: Event) => any"
2527+
}
2528+
]
2529+
},
2530+
{
2531+
"kind": "property",
2532+
"interface": "Request",
2533+
"readonly": true,
2534+
"name": "signal",
2535+
"type": "AbortSignal"
2536+
},
2537+
{
2538+
"kind": "property",
2539+
"interface": "RequestInit",
2540+
"name": "signal?",
2541+
"type": "AbortSignal"
24912542
}
2492-
]
2543+
]

0 commit comments

Comments
 (0)