Answers for "how to do seassion timeout"

28

timeout javascript

setTimeout(function(){
 	//code goes here
}, 2000); //Time before execution
Posted by: Guest on April-13-2020
0

settimeout javascript see how much time is left

var timeout = setTimeout(function() {}, 3600 * 1000);

setInterval(function() {
    console.log('Time left: '+getTimeLeft(timeout)+'s');
}, 2000);

function getTimeLeft(timeout) {
    return Math.ceil((timeout._idleStart + timeout._idleTimeout - Date.now()) / 1000);
}
Posted by: Guest on July-21-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language