Async
Async flow control: retry, timeout, polling and sleeping.
retry
Retry a (sync or async) function until it succeeds or retries are exhausted.
withTimeout
Race a promise against a time budget. Rejects with TimeoutError when the budget is exceeded (the underlying work is not cancelled — pass an AbortSignal for that).
waitFor
Poll a predicate until it returns a truthy value, or time out.
sleep
Promise-based delay.
Demo
retry against a flaky function that always fails twice before succeeding:
Loading...
withTimeout racing a slow task against a 1s budget:
Loading...
