JSFiddle - React, Tailwind, and code Playground
JavaScript
var t;
document.addEventListener('mousemove', function() {
if (t) clearTimeout(t);
t = setTimeout(function() {
alert('mouse hasn\'t moved for 5 seconds');
}, 5000);
});
var t;
document.addEventListener('mousemove', function() {
if (t) clearTimeout(t);
t = setTimeout(function() {
alert('mouse hasn\'t moved for 5 seconds');
}, 5000);
});