Profuter,
let workerFlag, timer, pause = 30 * 60 * 1000;
function worker() {
if (workerFlag) return;
//code...
}
function dream() {
window.clearTimeout(timer);
workerFlag = false;
timer = window.setTimeout(() => workerFlag = true, pause)
}
document.addEventListener("mousemove", dream);
document.addEventListener("keydown", dream);