beautiful-react-hooks
Version:
A collection of beautiful (and hopefully useful) React hooks to speed-up your components and hooks development
12 lines (11 loc) • 599 B
TypeScript
import { GenericFunction } from './shared/types';
declare type UseConditionalTOOpts = {
cancelOnUnmount?: boolean;
cancelOnConditionChange?: boolean;
};
/**
* An async-utility hook that accepts a callback function and a delay time (in milliseconds), then delays the
* execution of the given function by the defined time from when the condition verifies.
*/
declare const useConditionalTimeout: <TCallback extends GenericFunction>(fn: TCallback, milliseconds: number, condition: boolean, options?: UseConditionalTOOpts) => (boolean | (() => void))[];
export default useConditionalTimeout;