Function: waitFor()
waitFor<
T>(predicate,options?):Promise<NonNullable<T>>
Polls a predicate until it returns a truthy value, then resolves with that value. This is the right tool when the operation did not fail — the result is simply not ready yet (a DOM element that has not rendered, a flag that has not been set, data that has not arrived).
The predicate is evaluated immediately, then every interval ms.
May be sync or async; a rejected predicate is treated as "not ready".
Type Parameters
T
T
Parameters
predicate
() => T | Promise<T>
Evaluated repeatedly until it returns a truthy value.
options?
Polling behaviour — see WaitForOptions.
Returns
Promise<NonNullable<T>>
A Promise resolving with the first truthy value.
