Class CancelablePromise<T>

Type Parameters

  • T

Implements

  • Promise<T>

Constructors

  • Type Parameters

    • T

    Parameters

    • executor: ((resolve: ((value: T | PromiseLike<T>) => void), reject: ((reason?: any) => 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?: any) => void)
              • (reason?): void
              • Parameters

                • Optionalreason: any

                Returns void

          • onCancel: OnCancel

          Returns void

    Returns CancelablePromise<T>

Accessors

Methods

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

    Type Parameters

    • TResult = never

    Parameters

    • OptionalonRejected: null | ((reason: any) => 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.