JSFiddle - React, Tailwind, and code Playground
by hirambq
HTML
Move your mouse here and then wait 2 seconds of inactivity
JavaScript
var inactivityTime = function () {
var t;
window.onload = resetTimer;
document.onmousemove = resetTimer;
document.onkeypress = resetTimer;
function logout() {
alert("Your sesion has end, plase login again.")
location.href = "http://bing.com";
}
function resetTimer() {
clearTimeout(t);
t = setTimeout(logout, 2000)
// 1 segundo = 10000
}
};
inactivityTime();