Class Deferred<T>

The promise that can be resolved externally.

Type Parameters

  • T

    The value that the promise is fulfilled with.

Hierarchy

Constructors

Properties

Accessors

Constructors

  • Creates a new instance of Deferred.

    Type Parameters

    • T

      The value that the promise is fulfilled with.

    Returns Deferred<T>

Properties

reject: ((reason?) => void)

Rejects the promise with the specified reason. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.

Type declaration

    • (reason?): void
    • Parameters

      • Optional reason: any

        The rejection reason for the associated promise. Although the reason can be undefined, it is generally an Error object, like in exception handling.

        Note: This argument should not be a promise. Specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.

      Returns void

resolve: ((value) => void)

Fulfills the promise with the specified value. If the promise has already been resolved, either to a value, a rejection, or another promise, this method does nothing.

Type declaration

    • (value): void
    • Parameters

      • value: Awaitable<T>

        If this value is not a promise, including undefined, it becomes the fulfillment value of the associated promise. If this value is a promise, then the associated promise will be resolved to the passed promise, and follow the state as the provided promise (including any future transitions).

      Returns void

Accessors

  • get [species](): PromiseConstructor
  • Returns PromiseConstructor