@tsdotnet/promises - v2.0.11
    Preparing search index...

    Class PromiseCollection<T>

    A Promise collection exposes useful methods for handling a collection of promises and their results.

    Type Parameters

    • T

    Hierarchy

    • default
      • PromiseCollection
    Index

    Constructors

    Accessors

    • get promises(): PromiseLike<T>[]

      Returns a copy of the source promises.

      Returns PromiseLike<T>[]

    Methods

    • Returns void

    • Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.

      Returns ArrayPromise<T>

    • Applies a transform to each promise and defers the result. Unlike map, this doesn't wait for all promises to resolve, ultimately improving the async nature of the request.

      Type Parameters

      • U

      Parameters

      • transform: (value: T) => U | PromiseLike<U>

      Returns PromiseCollection<U>

    • Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.

      Returns PromiseBase<T>

      A new Promise.

    • Behaves like array reduce. Creates the promise chain necessary to produce the desired result.

      Parameters

      • reduction: (previousValue: T, currentValue: T, i?: number, array?: PromiseLike<T>[]) => T
      • OptionalinitialValue: T | PromiseLike<T>

      Returns PromiseBase<T>

    • Behaves like array reduce. Creates the promise chain necessary to produce the desired result.

      Type Parameters

      • U

      Parameters

      • reduction: (previousValue: U, currentValue: T, i?: number, array?: PromiseLike<T>[]) => U
      • initialValue: U | PromiseLike<U>

      Returns PromiseBase<U>

    • Returns a promise that is fulfilled with array of provided promises when all provided promises have resolved (fulfill or reject). Unlike .all this method waits for all rejections as well as fulfillment.

      Returns ArrayPromise<PromiseLike<T>>