@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
17 lines (16 loc) • 437 B
TypeScript
declare class Timeout {
static create(): Timeout;
currentId: number;
/**
* Executes `fn` after `delay`, clearing any previously scheduled call.
*/
start(delay: number, fn: () => void): void;
isStarted(): boolean;
clear: () => void;
disposeEffect: () => () => void;
}
/**
* A `setTimeout` with automatic cleanup and guard.
*/
declare function useTimeout(): Timeout;
export { Timeout, useTimeout };