@rbxts/pretty-react-hooks
Version:
Useful hooks for @rbxts/react
10 lines (9 loc) • 422 B
TypeScript
/**
* Sets a timeout that runs the callback function after `delay` seconds. If
* `delay` is `undefined`, the timeout is cleared. If the delay changes, the
* timeout is reset.
* @param callback The callback function to run.
* @param delay The delay in seconds before the timeout.
* @returns A function that clears the timeout.
*/
export declare function useTimeout(callback: () => void, delay?: number): () => void;