UNPKG

@nesvet/n

Version:
26 lines 1.15 kB
export type WaitUntilOptions = { /** Maximum time to wait in milliseconds (0 for no timeout) */ timeout?: number; /** Polling interval in milliseconds */ interval?: number; /** Whether to throw an error on timeout */ throwOnTimeout?: boolean; /** Custom timeout message */ timeoutMessage?: string; /** Callback function called on each interval with elapsed time in ms */ onInterval?: (elapsedMs: number) => void; /** Callback function called on timeout */ onTimeout?: () => void; /** Callback function called on success */ onSuccess?: () => void; /** Whether to check condition immediately before first wait */ immediateFirstCheck?: boolean; }; /** * Waits until a condition function returns true * @param condition Function that returns true when the waiting should end * @param options Configuration options * @returns Promise resolving to true when condition is met, or false on timeout (if throwOnTimeout is false) */ export declare function waitFor(condition: () => Promise<boolean> | boolean, options?: WaitUntilOptions): Promise<boolean>; //# sourceMappingURL=waitFor.d.ts.map