Skip to main content

Function: retrySync()

retrySync<T>(cb: () => T, retries: number): T

Synchronously calls the callback function until it either succeeds or it runs out of retries. For an asynchronous variant, see retry.

Type parameters

Type parameter
T

Parameters

ParameterTypeDescription
cb() => TThe function to be retried is passed in as a callback function.
retriesnumberThe number of retries is also passed in as a parameter. Minimum of 0.

Returns

T

The result of the callback function is returned.

Source

lib/retrySync.ts:8