UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

14 lines 620 B
/** * Function repeats provided call until it returns not null or undefined value. * If this process exceeds `maxDurationMs` function will throw * of those function calls. * * @param fn - The function to invoke. * @param maxDurationMs - Max waiting duration * @example * const result = await waitUntilDefined(() => document.body.getElementById("#app")) * @category Utility * @throws If if fn does not return not nil value in given time frame */ export declare function waitUntilDefined<T>(fn: () => T | undefined, maxDurationMs: number): Promise<NonNullable<T>>; //# sourceMappingURL=waitUntilDefined.d.ts.map