• Invokes a callback periodically until it successfully returns the result. If a callback throws an error or returns a promise that is rejected then it is invoked again after a delay.

    Type Parameters

    • T

      The value returned by the callback.

    Parameters

    • cb: ((signal, index) => Awaitable<T>)

      The callback that must return the fulfilled result.

    • Optional ms: number | ((error, index) => number)

      The number of milliseconds between the rejection of the last promise returned by the callback and the next invocation. Or a callback that receives the latest error and returns the delay. If omitted then delay is 0.

    • Optional maxCount: number

      The maximum number of retries after which the last rejection reason is thrown.

    Returns AbortablePromise<T>

    The promise that is fulfilled with the callback result.

    See

    repeat