Last active
January 5, 2021 12:53
-
-
Save sadewole/2353ecc6f69af94d0c100922ad9e4889 to your computer and use it in GitHub Desktop.
setTimeout func.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SessionTimeout = () => { | |
const [events, setEvents] = useState(['click', 'load', 'scroll']); | |
const [second, setSecond] = useState(0); | |
let timeStamp; | |
let warningInactiveInterval = useRef(); | |
let startTimerInterval = useRef(); | |
// start inactive check | |
let timeChecker = () => { | |
startTimerInterval.current = setTimeout(() => { | |
let storedTimeStamp = sessionStorage.getItem('lastTimeStamp'); | |
warningInactive(storedTimeStamp); | |
}, 60000); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment