Answers for "settimeout javascript see how much time is left"

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 "settimeout javascript see how much time is left"

Code answers related to "Javascript"

Browse Popular Code Answers by Language