JS API Reference

Module: shared/utils/wait

Table of contents

Functions

Functions

waitForCondition

waitForCondition(check, opts?): Promise<void>

Utility function that helps to block the execution until a condition is met (check returns true) or the timeout happens.

Parameters

NameTypeDescription
check() => boolean | Promise<boolean>The function checking if the condition is met.
opts?ObjectOptions controlling the timeout and check interval in seconds.
opts.signalOrTimeout?number | AbortSignalThe timeout value in miliseconds or AbortSignal.
opts.intervalSeconds?numberThe interval between condition checks in seconds.

Returns

Promise<void>

  • Resolves when the condition is met or rejects with a timeout error if it wasn't met on time.

Defined in

src/shared/utils/wait.ts:14


waitAndCall

waitAndCall<T>(fn, waitSeconds): Promise<T>

Simple utility that allows you to wait n-seconds and then call the provided function

Type parameters

Name
T

Parameters

NameType
fn() => T | Promise<T>
waitSecondsnumber

Returns

Promise<T>

Defined in

src/shared/utils/wait.ts:52

Was this helpful?