smart-idle
Version:
Lightweight browser library to detect user inactivity with event dispatching
29 lines (27 loc) • 609 B
TypeScript
interface SmartIdleOptions {
timeout?: number;
onIdle?: () => void;
onActive?: () => void;
events?: string[];
}
declare class SmartIdle {
private timeout;
private onIdle;
private onActive;
private _timer;
private _idle;
private _paused;
private _events;
constructor(options?: SmartIdleOptions);
start(): void;
stop(): void;
pause(): void;
resume(): void;
isIdle(): boolean;
triggerIdle(): void;
triggerActive(): void;
destroy(): void;
private _handleEvent;
private _resetTimer;
}
export { SmartIdle, SmartIdleOptions };