import { AbortablePromise } from './AbortablePromise'; import { Awaitable } from './types'; /** * Invokes a callback periodically with the given delay between fulfillment of returned promises until the condition is * met. If callback throws an error or returns a rejected promise, then the promise returned from {@link repeat} is * rejected. * * @param cb The callback that is periodically invoked. * @param ms The number of milliseconds between the settlement of the last promise returned by the callback and the * next invocation. Or a callback that receives the latest result and returns the delay. If omitted then delay is 0. * @param until The callback that should return `true` to terminate the loop, or `false` to proceed to the next * iteration. The condition is checked before the next iteration is scheduled. If omitted then loop is repeated * indefinitely. * @template I The value returned by the callback. * @template O The value that fulfills the returned promise. * @returns The promise that is fulfilled with the callback result. * @see {@link retry} */ export declare function repeat(cb: (signal: AbortSignal, index: number) => Awaitable, ms: ((value: I, index: number) => number) | number | undefined, until: (value: I, index: number) => value is O): AbortablePromise; /** * Invokes a callback periodically with the given delay between fulfillment of returned promises until the condition is * met. If callback throws an error or returns a rejected promise, then the promise returned from {@link repeat} is * rejected. * * @param cb The callback that is periodically invoked. * @param ms The number of milliseconds between the settlement of the last promise returned by the callback and the next * invocation. Or a callback that receives the latest result and returns the delay. If omitted then delay is 0. * @param until The callback that should return truthy value to terminate the loop, or falsy to proceed to the next * iteration. The condition is checked before the next iteration is scheduled. If omitted then loop is repeated * indefinitely. * @template T The value returned by the callback. * @returns The promise that is fulfilled with the callback result. * @see {@link retry} */ export declare function repeat(cb: (signal: AbortSignal, index: number) => Awaitable, ms?: ((value: T, index: number) => number) | number, until?: (value: T, index: number) => unknown): AbortablePromise;