Function asyncTasksSerial

  • Executes an array of asynchronous tasks in a serial manner, one after the other. Returns a promise that resolves with an array of results of each task.

    Type Parameters

    • T

      The type of the result of each task.

    Parameters

    • tasks: (() => Promise<T>)[]

      An array of functions that return a promise.

    Returns Promise<T[]>

    A promise that resolves with an array of results of each task.

    Example

    [() => Promise.resolve(1), () => Promise.resolve(2), () => Promise.resolve(3)].map(task => asyncTasksSerial(task));
    //=> [1, 2, 3]

    Throws

    If any of the tasks fail, the function will throw an error.

Generated using TypeDoc