• runConcurrent runs executors that come from executorProvider by at most maxConcurrency workers. The workers continue to run the executors until the generator that is supplied by generatorFunction notifies done, i.e. once the generator has become done.

    Returns

    a promise that returns the arrays of R for each worker.

    Type Parameters

    • T

      The argument type of the executor. That argument must be provided by the generator.

    • R

      The result type of the executor, and propagates that result to this function's Promise.

    Parameters

    • maxConcurrency: number

      the number of the maximum concurrent workers.

    • executorProvider: ((arg: T) => ((resolve: ((value: R | PromiseLike<R>) => void), reject: ((reason?: unknown) => void)) => void))

      a provider function that returns an executor for a worker according to the T typed value that comes from the generator.

        • (arg: T): ((resolve: ((value: R | PromiseLike<R>) => void), reject: ((reason?: unknown) => void)) => void)
        • Parameters

          • arg: T

          Returns ((resolve: ((value: R | PromiseLike<R>) => void), reject: ((reason?: unknown) => void)) => void)

            • (resolve: ((value: R | PromiseLike<R>) => void), reject: ((reason?: unknown) => void)): void
            • Parameters

              • resolve: ((value: R | PromiseLike<R>) => void)
                  • (value: R | PromiseLike<R>): void
                  • Parameters

                    • value: R | PromiseLike<R>

                    Returns void

              • reject: ((reason?: unknown) => void)
                  • (reason?: unknown): void
                  • Parameters

                    • Optional reason: unknown

                    Returns void

              Returns void

    • generatorFunction: (() => IterableIterator<T>)

      a generator function that returns an argument for executorProvider. If this generator returns done value, this function finishes the workers' executions and returns the result.

        • (): IterableIterator<T>
        • Returns IterableIterator<T>

    Returns Promise<Awaited<R[][]>>

Generated using TypeDoc