@safe-global/safe-react-hooks
Version:
A collection of React Hooks that facilitates the interaction of React apps with Safe Smart Accounts
15 lines (14 loc) • 694 B
TypeScript
/**
* Poll a function until a condition is met.
* @param fn Function to poll.
* @param fnCondition Function to check if the polling should stop. As long as this function returns `true`, the polling will continue.
* @param ms Optional number of milliseconds to wait between each poll. Default is 1000 ms.
* @returns Result of the polling.
*/
export declare function poll<Result>(fn: () => Promise<Result>, fnCondition: (result: Result) => boolean, ms?: number): Promise<Result>;
/**
* Wait for a number of milliseconds.
* @param ms Number of milliseconds to wait.
* @returns Promise that resolves after `ms` milliseconds.
*/
export declare function wait(ms: number): Promise<unknown>;