Function: pollSync()
pollSync<
T>(cb: () =>T,cbCondition: (value:T) =>boolean,options:SyncPollOptions):T
Defined in: pollSync.ts:29
Executes a function cb and validates the result with function cbCondition,
and repeats this until cbCondition returns true or the timeout is reached.
For an asynchronous variant, see poll.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
cb | () => T | The function that should be executed. |
cbCondition | (value: T) => boolean | A function that when given the result of fn should return true if the polling should stop and should return false if the polling should continue. |
options | SyncPollOptions | Options to provide further modifying behaviour. |
Returns
T
The result of cb as soon as cbCondition returns true, or an error if timeout is reached.
Throws
If timeout is reached.