stop the refresh countdown once we hit zero

This commit is contained in:
Stephen Birarda 2014-09-26 14:15:56 -07:00
parent 80f1594a17
commit 2a7626159c

View file

@ -193,13 +193,14 @@ function showRestartModal() {
refreshSpan.html(numberOfSecondsToWait + " seconds");
// call ourselves every 1 second to countdown
window.setInterval(function(){
var refreshCountdown = setInterval(function(){
secondsElapsed++;
secondsLeft = numberOfSecondsToWait - secondsElapsed
refreshSpan.html(secondsLeft + (secondsLeft == 1 ? " second" : " seconds"))
if (secondsElapsed == numberOfSecondsToWait) {
location.reload(true);
clearInterval(refreshCountdown);
}
}, 1000);
}