@lodestar/utils
Version:
Utilities required across multiple lodestar packages
26 lines • 813 B
TypeScript
export type WaitForOpts = {
/** Time in milliseconds between checking condition */
interval?: number;
/** Time in milliseconds to wait before throwing TimeoutError */
timeout?: number;
/** Abort signal to stop waiting for condition by throwing ErrorAborted */
signal?: AbortSignal;
};
/**
* Wait for a condition to be true
*/
export declare function waitFor(condition: () => boolean, opts?: WaitForOpts): Promise<void>;
export interface ElapsedTimeTracker {
(): boolean;
msSinceLastCall: number;
}
/**
* Create a tracker which keeps track of the last time a function was called
*
* @param durationMs
* @returns
*/
export declare function createElapsedTimeTracker({ minElapsedTime }: {
minElapsedTime: number;
}): ElapsedTimeTracker;
//# sourceMappingURL=waitFor.d.ts.map