Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AbortSignal

Package version

An aborter instance implements AbortSignal interface, can abort HTTP requests.

  • Call AbortSignal.none to create a new AbortSignal instance that cannot be cancelled. Use AbortSignal.none when you are required to pass a cancellation token but the operation cannot or will not ever be cancelled.
example

// Abort without timeout await doAsyncWork(AbortSignal.none);

export
class

AbortSignal

implements

{AbortSignalLike}

Hierarchy

  • AbortSignal

Implements

Index

Constructors

constructor

  • Returns AbortSignal

Properties

aborted

aborted: boolean

Status of whether aborted or not.

readonly
type

{boolean}

memberof

AbortSignal

onabort

onabort: null | function

onabort event listener.

memberof

AbortSignal

Static none

Creates a new AbortSignal instance that will never be aborted.

readonly
static
type

{AbortSignal}

memberof

AbortSignal

Methods

addEventListener

  • addEventListener(_type: "abort", listener: function): void
  • Added new "abort" event listener, only support "abort" event.

    memberof

    AbortSignal

    Parameters

    • _type: "abort"

      Only support "abort" event

    • listener: function

    Returns void

dispatchEvent

  • dispatchEvent(event: Event): boolean
  • Dispatches a synthetic event to the AbortSignal.

    Parameters

    • event: Event

    Returns boolean

removeEventListener

  • removeEventListener(_type: "abort", listener: function): void
  • Remove "abort" event listener, only support "abort" event.

    memberof

    AbortSignal

    Parameters

    • _type: "abort"

      Only support "abort" event

    • listener: function

    Returns void

Generated using TypeDoc