Skip to content

Commit 8ebb762

Browse files
authored
Merge pull request #345 from jiripudil/abortable-fetch-typings
Add abortable fetch interfaces
2 parents ddd546a + 2bc88ff commit 8ebb762

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;
@@ -9235,6 +9236,7 @@ interface Request extends Object, Body {
92359236
readonly referrerPolicy: ReferrerPolicy;
92369237
readonly type: RequestType;
92379238
readonly url: string;
9239+
readonly signal: AbortSignal;
92389240
clone(): Request;
92399241
}
92409242

@@ -14787,6 +14789,21 @@ interface WEBGL_lose_context {
1478714789
restoreContext(): void;
1478814790
}
1478914791

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

1479214809
interface DecodeErrorCallback {
@@ -15367,4 +15384,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated
1536715384
type Transport = "usb" | "nfc" | "ble";
1536815385
type VideoFacingModeEnum = "user" | "environment" | "left" | "right";
1536915386
type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded";
15370-
type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";
15387+
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)