Class PromiseResolver<T>

A resolver of promise that can be created later or not created at all.

Creates the promise only on demand.

The methods of this object do not require this context and can be called as functions.

Type Parameters

  • in out T = void

    The type of value the promise resolves to.

Hierarchy

  • PromiseResolver

Constructors

Properties

Constructors

Properties

reject: ((this, reason?) => void)

Type declaration

    • (this, reason?): void
    • Rejects the promise.

      Has no effect when the resulting promise already settled.

      Can be called before the resulting promise created.

      Parameters

      • this: void
      • Optional reason: unknown

        Promise rejection reason.

      Returns void

resolve: ((this, resolution) => void)

Type declaration

    • (this, resolution): void
    • Resolves the promise.

      Has no effect when the resulting promise already settled.

      Can be called before the resulting promise created.

      Parameters

      • this: void
      • resolution: T | PromiseLike<T>

        Either a promise value, or a promise-like instance resolving to one.

      Returns void

whenDone: ((this) => Promise<T>)

Type declaration

    • (this): Promise<T>
    • Creates a promise resolved by resolve, or rejected by reject.

      The subsequent calls to this method return the same promise instance.

      Parameters

      • this: void

      Returns Promise<T>

      Resulting promise.

Generated using TypeDoc