abort-controller.d.ts (1020B)
1 import { EventTarget } from "event-target-shim" 2 3 type Events = { 4 abort: any 5 } 6 type EventAttributes = { 7 onabort: any 8 } 9 /** 10 * The signal class. 11 * @see https://dom.spec.whatwg.org/#abortsignal 12 */ 13 declare class AbortSignal extends EventTarget<Events, EventAttributes> { 14 /** 15 * AbortSignal cannot be constructed directly. 16 */ 17 constructor() 18 /** 19 * Returns `true` if this `AbortSignal`"s `AbortController` has signaled to abort, and `false` otherwise. 20 */ 21 readonly aborted: boolean 22 } 23 /** 24 * The AbortController. 25 * @see https://dom.spec.whatwg.org/#abortcontroller 26 */ 27 declare class AbortController { 28 /** 29 * Initialize this controller. 30 */ 31 constructor() 32 /** 33 * Returns the `AbortSignal` object associated with this object. 34 */ 35 readonly signal: AbortSignal 36 /** 37 * Abort and signal to any observers that the associated activity is to be aborted. 38 */ 39 abort(): void 40 } 41 42 export default AbortController 43 export { AbortController, AbortSignal }