Skip to content

Instantly share code, notes, and snippets.

View bhaumik55231's full-sized avatar

Bhaumik Patel bhaumik55231

View GitHub Profile
@bhaumik55231
bhaumik55231 / inactivity.js
Created June 15, 2021 16:57
Track user inactivity on a web page using javascript
const inactivityTime = () => {
let time;
const resetTimer = () => {
clearTimeout(time);
time = setTimeout(() => {
const resposeTimeout = setTimeout(() => {
// log out user if they don't respond to warning after 5 minutes.
logOut();
}, 300000)
// Show warning after 20 minutes of no activity.
export const configurations = {
"some_secret": "231wutedutwfqytrytwefu"
}