Skip to content

Instantly share code, notes, and snippets.

@rmariuzzo
Created May 15, 2019 22:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmariuzzo/204d299593dbd40920c545017689de7b to your computer and use it in GitHub Desktop.
Save rmariuzzo/204d299593dbd40920c545017689de7b to your computer and use it in GitHub Desktop.
Refresh a web page when no mouse activity
// DO NOT COMMIT
(() => {
const keepAwake = () => {
clearTimeout(keepAwake.nod.timeoutId)
keepAwake.nod()
}
keepAwake.nod = () => {
keepAwake.nod.timeoutId = setTimeout(() => {
location.reload()
keepAwake.nod()
}, 1e3 * 60 * 15)
}
document.addEventListener('mousemove', keepAwake)
keepAwake.nod()
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment