Skip to main content

Function: waitFor()

waitFor<T>(callback, options?): Promise<T>

Defined in: wait-for.ts:14

Waits for a callback to succeed without throwing an error.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
callback() => TFunction to execute repeatedly until it succeeds
options?WaitForOptionsWait options (timeout, interval, onTimeout)

Returns

Promise<T>

Promise resolving to the callback's return value

Throws

If the callback keeps failing after the timeout period