Skip to content

API Reference / @gtkx/testing / waitFor

Function: waitFor() ​

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

Defined in: packages/testing/src/wait-for.ts:98

Repeatedly invokes a callback until it succeeds without throwing or the timeout elapses, retrying on each rejection at a fixed interval.

Type Parameters ​

T ​

T

Parameters ​

callback ​

() => T | Promise<T>

The assertion or query to retry; its resolved value is returned.

options? ​

WaitForOptions

Optional timeout, interval, and timeout error customization.

Returns ​

Promise<T>

The callback's result once it succeeds.