timeout-flow
Version:
Fluent, composable, pauseable JavaScript timers and time control flows — plus RAF utilities for frame-based logic.
13 lines (12 loc) • 474 B
TypeScript
/**
* Waits for a condition to become true, polling at intervals.
* @param {Function} condition - returns truthy when satisfied
* @param {Object} options - optional polling control
* @param {string} [options.interval='250ms']
* @param {string} [options.timeout] - max wait time
* @returns {Promise<void>}
*/
export function waitFor(condition: Function, { interval, timeout }?: {
interval?: string | undefined;
timeout?: string | undefined;
}): Promise<void>;