Repeatedly runs an iteratee while the async test returns true.
Condition evaluated before each iteration.
Async body executed while test is true.
test
Optional
Cancellable configuration options.
A cancellable handle that resolves when the loop exits.
let count = 0;const handle = whilst( async () => count < 3, async (token) => { await token.sleep(5); count++; },);await handle;// count === 3 Copy
let count = 0;const handle = whilst( async () => count < 3, async (token) => { await token.sleep(5); count++; },);await handle;// count === 3
Repeatedly runs an iteratee while the async test returns true.