UNPKG

@bigmi/core

Version:

TypeScript library for Bitcoin apps.

22 lines (21 loc) 840 B
/** * Retries a condition until it's met or timeout is reached. * Polls the condition function at regular intervals. * * @param condition - Function that returns a truthy value when condition is met * @param options - Configuration options for retry behavior * @returns Promise that resolves to the condition result or undefined if timeout * * @example * // Wait for a value to become available * const value = await retryUntil( * async () => await checkCondition(), * { timeout: 5000, interval: 100 } * ) */ export declare function retryUntil<T>(condition: () => Promise<T | undefined | null | false>, options?: { /** Maximum time to wait in milliseconds (default: 5000ms) */ timeout?: number; /** Interval between checks in milliseconds (default: 100ms) */ interval?: number; }): Promise<T | undefined>;