• Asynchronously completes a generator function, yielding values and respecting a maximum time per tick.

    Type Parameters

    • T

      The type of values yielded by the generator.

    • TReturn

      The type of the return value of the generator.

    • TNext

      The type of the value that can be passed to the generator's next method.

    Parameters

    • g: Generator<T, TReturn, TNext>

      The generator function to complete.

    • OptionalmaxTimePerTick: number

      The maximum time (in milliseconds) to spend on each tick before yielding control back to the system.

    • OptionalwhileConditions: boolean

      A condition to keep the generator running.

    Returns Promise<{ return: TReturn; yield: T[] }>

    A promise that resolves with an object containing the yielded values and the return value of the generator.