UNPKG

898 BTypeScriptView Raw
1// `AbortSignal` is defined here to prevent a dependency on a particular
2// implementation like the `abort-controller` package, and to avoid requiring
3// the `dom` library in `tsconfig.json`.
4
5export interface AbortSignal {
6 aborted: boolean;
7 reason: any;
8
9 addEventListener: (
10 type: "abort",
11 listener: (this: AbortSignal, event: any) => any,
12 options?: boolean | {
13 capture?: boolean | undefined;
14 once?: boolean | undefined;
15 passive?: boolean | undefined;
16 },
17 ) => void;
18
19 removeEventListener: (
20 type: "abort",
21 listener: (this: AbortSignal, event: any) => any,
22 options?: boolean | {
23 capture?: boolean | undefined;
24 },
25 ) => void;
26
27 dispatchEvent: (event: any) => boolean;
28
29 onabort: null | ((this: AbortSignal, event: any) => any);
30
31 throwIfAborted(): void;
32}
33
\No newline at end of file