Skip to content

Instantly share code, notes, and snippets.

@Romick2005
Romick2005 / idletime.js
Created April 3, 2024 09:18 — forked from barraponto/idletime.js
ES6+ event-based browser idle timer.
const DOCUMENT_EVENTS = [
'mousemove', 'mousedown', 'click',
'touchmove', 'touchstart', 'touchend',
'keydown', 'keypress'
];
export class IdleTimer {
constructor(onIdleTimeout, timeout) {
this.onIdleTimeout = onIdleTimeout;
this.timeout = timeout;
@Romick2005
Romick2005 / idletime.js
Created April 3, 2024 09:18 — forked from barraponto/idletime.js
ES6+ event-based browser idle timer.
const DOCUMENT_EVENTS = [
'mousemove', 'mousedown', 'click',
'touchmove', 'touchstart', 'touchend',
'keydown', 'keypress'
];
export class IdleTimer {
constructor(onIdleTimeout, timeout) {
this.onIdleTimeout = onIdleTimeout;
this.timeout = timeout;