Skip to main content

CancelablePromise <T>

Implements

  • Promise<T>

Index

Constructors

constructor

  • new CancelablePromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void): CancelablePromise<T>
  • Type parameters

    • T

    Parameters

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

    Returns CancelablePromise<T>

Accessors

[toStringTag]

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

publicisCancelled

  • get isCancelled(): boolean
  • Returns boolean

Methods

publiccancel

  • cancel(): void
  • Returns void

publiccatch

  • catch<TResult>(onRejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>
  • Type parameters

    • TResult = never

    Parameters

    • optionalonRejected: (reason: any) => TResult | PromiseLike<TResult>

    Returns Promise<T | TResult>

publicfinally

  • finally(onFinally?: () => void): Promise<T>
  • Parameters

    • optionalonFinally: () => void

    Returns Promise<T>

publicthen

  • then<TResult1, TResult2>(onFulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onRejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>
  • Type parameters

    • TResult1 = T
    • TResult2 = never

    Parameters

    • optionalonFulfilled: (value: T) => TResult1 | PromiseLike<TResult1>
    • optionalonRejected: (reason: any) => TResult2 | PromiseLike<TResult2>

    Returns Promise<TResult1 | TResult2>