Class EveryPromiseResolver<T>

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

Promises to resolve can be passed to constructor, or added later, but not after the resulting promise fulfilled.

Creates the resulting 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 input promises resolve to.

Hierarchy

  • EveryPromiseResolver

Constructors

Properties

Constructors

Properties

add: ((this, ...promises) => EveryPromiseResolver<T>)

Type declaration

    • (this, ...promises): EveryPromiseResolver<T>
    • Adds promise(s) to resolve.

      Has no effect when the resulting promise already settled.

      Can be called before the resulting promise fulfilled.

      Calling without arguments causes the resulting promise to resolve.

      Parameters

      • this: void
      • Rest ...promises: (T | PromiseLike<T>)[]

        Promises to add to resolution.

      Returns EveryPromiseResolver<T>

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

Type declaration

    • (this, reason?): void
    • Rejects the resulting 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

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

Type declaration

    • (this): Promise<T[]>
    • Creates a promise resolved when every added promise resolved, or rejected when any of them rejected.

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

      Parameters

      • this: void

      Returns Promise<T[]>

      Resulting promise resolved to array of added promise resolutions.

Generated using TypeDoc