@chickenjdk/byteutils
    Preparing search index...

    Function knownAsyncWhileLoop

    • 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

      • IsAsync extends boolean

      Parameters

      • callback: () => MaybePromise<void, IsAsync>

        The callback to call.

      • condition: () => boolean

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

      • async: IsAsync

      Returns MaybePromise<void, IsAsync>

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