Type Parameters

  • T

Implements

Constructors

  • Type Parameters

    • T

    Parameters

    • executor: ((resolve: ((value: T | PromiseLike<T>) => void), reject: ((reason?: unknown) => void), onCancel: OnCancel) => void)
        • (resolve, reject, onCancel): void
        • Parameters

          • resolve: ((value: T | PromiseLike<T>) => void)
              • (value): void
              • Parameters

                • value: T | PromiseLike<T>

                Returns void

          • reject: ((reason?: unknown) => void)
              • (reason?): void
              • Parameters

                • Optionalreason: unknown

                Returns void

          • onCancel: OnCancel

          Returns void

    Returns CancelablePromise<T>

Properties

cancelHandlers: (() => void)[]
promise: Promise<T>

Accessors

  • get [toStringTag](): string
  • Returns string

  • get isCancelled(): boolean
  • Returns boolean

Methods

  • Returns void

  • Attaches a callback for only the rejection of the Promise.

    Type Parameters

    • TResult = never

    Parameters

    • OptionalonRejected: null | ((reason: unknown) => TResult | PromiseLike<TResult>)

    Returns Promise<T | TResult>

    A Promise for the completion of the callback.

  • Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.

    Parameters

    • OptionalonFinally: null | (() => void)

    Returns Promise<T>

    A Promise for the completion of the callback.

  • Attaches callbacks for the resolution and/or rejection of the Promise.

    Type Parameters

    • TResult1 = T
    • TResult2 = never

    Parameters

    Returns Promise<TResult1 | TResult2>

    A Promise for the completion of which ever callback is executed.