Track whether user activity has been idle for a configured timeout.
function useIdle(options?: {
timeout?: number;
window?: Window | null;
document?: Document | null;
events?: string[];
listenForVisibilityChange?: boolean;
immediate?: boolean;
initialState?: boolean;
}): {
idle: () => boolean;
lastActive: () => number | null;
isSupported: () => boolean;
active: () => boolean;
reset: () => void;
pause: () => void;
resume: () => void;
};- Uses activity events on
windowand an internal timeout. pause()/resume()controls listener binding and timer scheduling.