• Asynchronously completes a generator function, yielding control back to the system if the execution time exceeds a specified limit per tick.

    Type Parameters

    • T

      The type of the yielded values.

    • TReturn

      The type of the return value.

    • TNext

      The type of the next value.

    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: string | number | boolean | Function

      The condition to continue running the generator. Can be a boolean, number, string, or function.

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

    A promise that resolves with the final yielded value and the return value of the generator.