@chickenjdk/byteutils
    Preparing search index...

    Function maybeAsyncWhileLoop

    • Like a while loop, but calls a callback each repetition. Returns a promise that resolves when the loop finishes if the callback is async, and runs normally if it is not async. Avoids stack overflow by using a loop, not recursive callbacks

      Type Parameters

      • Returns extends void | Promise<void>

      Parameters

      • callback: () => Returns

        The callback to call.

      • condition: () => boolean

        A function that returns true to keep the loop going, and false to stop it.

      Returns Returns extends Promise<void> ? Promise<void> : void

      A promise if the function is async, or void if not