JSFiddle - React, Tailwind, and code Playground

by D Guillory

JavaScript

//this is in milliseconds not seconds
checkInactive(30000, function(){
    alert('Inactive for 30,000 milliseconds');   
});
    
function checkInactive(ms, cb){   
    var wait = setTimeout(cb, ms);        
    document.mousemove = document.mousedown = document.mouseup =         document.onkeydown = document.onkeyup = document.focus =  function(){
        clearTimeout(wait);
        wait = setTimeout(cb, ms);
            
    };

}