Class PromiseDelegate<T>

A class which wraps a promise into a delegate object.

Notes

This class is useful when the logic to resolve or reject a promise cannot be defined at the point where the promise is created.

Type Parameters

  • T

Constructors

Properties

Methods

Constructors

Properties

_reject: ((reason) => void)

Type declaration

    • (reason): void
    • Parameters

      • reason: any

      Returns void

_resolve: ((value) => void)

Type declaration

    • (value): void
    • Parameters

      • value: T | PromiseLike<T>

      Returns void

promise: Promise<T>

The promise wrapped by the delegate.

Methods

  • Reject the wrapped promise with the given value.

    Parameters

    • reason: unknown

    Returns void

    Reason

    • The reason for rejecting the promise.
  • Resolve the wrapped promise with the given value.

    Parameters

    • value: T | PromiseLike<T>

      The value to use for resolving the promise.

    Returns void