1 | export interface AbortHandler {
|
2 | (this: AbortSignal, ev: any): any;
|
3 | }
|
4 | /**
|
5 | * Holders of an AbortSignal object may query if the associated operation has
|
6 | * been aborted and register an onabort handler.
|
7 | *
|
8 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
9 | */
|
10 | export interface AbortSignal {
|
11 | /**
|
12 | * Whether the action represented by this signal has been cancelled.
|
13 | */
|
14 | readonly aborted: boolean;
|
15 | /**
|
16 | * A function to be invoked when the action represented by this signal has
|
17 | * been cancelled.
|
18 | */
|
19 | onabort: AbortHandler | null;
|
20 | }
|
21 | /**
|
22 | * The AWS SDK uses a Controller/Signal model to allow for cooperative
|
23 | * cancellation of asynchronous operations. When initiating such an operation,
|
24 | * the caller can create an AbortController and then provide linked signal to
|
25 | * subtasks. This allows a single source to communicate to multiple consumers
|
26 | * that an action has been aborted without dictating how that cancellation
|
27 | * should be handled.
|
28 | *
|
29 | * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
30 | */
|
31 | export interface AbortController {
|
32 | /**
|
33 | * An object that reports whether the action associated with this
|
34 | * {AbortController} has been cancelled.
|
35 | */
|
36 | readonly signal: AbortSignal;
|
37 | /**
|
38 | * Declares the operation associated with this AbortController to have been
|
39 | * cancelled.
|
40 | */
|
41 | abort(): void;
|
42 | }
|