Skip to content

API Reference / @gtkx/testing / waitFor

Variable: waitFor

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

Defined in: wait-for.d.ts:11

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.

Released under the MPL-2.0 License.