Interface ReadonlyAbort

interface ReadonlyAbort {
    aborted: boolean;
    nativeSignal: null | AbortSignal;
    reason: null | Error;
    hasAnyListeners(): boolean;
    hasListeners(type: "abort"): boolean;
    on<K>(type: K, handler: EventHandler<AbortEventMap[K]>, options?: SignalOptions): Unsubscribe;
    onAborted(callback: ((event: AbortEvent) => void)): Unsubscribe;
    throwIfAborted(): void;
}

Hierarchy (view full)

Implemented by

Properties

aborted: boolean

True if aborted.

nativeSignal: null | AbortSignal

Returns a native signal on supported platforms.

reason: null | Error

The reason passed to abort.

Methods

  • Returns true if the event host has any listeners.

    Returns boolean

  • Returns true if the event host has any listeners for the given type.

    Parameters

    • type: "abort"

    Returns boolean

  • Adds an event handler for the given typed event.

    Type Parameters

    • K extends "abort"

    Parameters

    • type: K

      The key representing the event type to listen for.

    • handler: EventHandler<AbortEventMap[K]>

      A callback to invoke when the event with the given type is dispatched.

    • Optionaloptions: SignalOptions

      Options for changing listening behavior.

    Returns Unsubscribe

    Returns a method, when invoked, removes the handler.

  • Invokes a callback on 'abort', or immediately if already aborted.

    Parameters

    Returns Unsubscribe

  • Throws the signal's abort reason if the signal has been aborted; otherwise it does nothing.

    Returns void