A "promise" that may be canceled.

Behaviors like a normal promise but does not actually extend Promise because that makes extension a PITA.

Type Parameters

  • T = void

Hierarchy

  • CancelablePromise

    Implements

    • Promise<T>

    Constructors

    Accessors

    Methods

    Constructors

    • Type Parameters

      • T = void

      Parameters

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

            Returns void

      • OptionalonCancel: (() => void)
          • (): void
          • Returns void

      Returns CancelablePromise<T>

    Accessors

    Methods

    • 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)

        The callback to execute when the Promise is settled (fulfilled or rejected).

      Returns CancelablePromise<T>

      A Promise for the completion of the callback.