Every line of 'set timer javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
84 setSecondsTimer() { 85 this.secondsTimer = setInterval(() => { 86 setSeconds(getSeconds() - 1) 87 this.checkPoint() 88 }, 1000) 89 }
18 function setTimer(timer, callback, interval) { 19 timers[timer.id] = { 20 callback, 21 interval, 22 lastRun: gameTime 23 }; 24 }
33 _setTimeout(callback, time) { 34 this._timer = setTimeout(() => { 35 callback() 36 this._finish = true 37 this._rest = null 38 }, time / this._rate) 39 40 this._finish = false 41 this._time = time 42 this._startTime = new Date() 43 this._callback = callback 44 this._rest = null 45 }
10 _setTimer () { 11 this.timeoutId = setTimeout(() => { 12 this.flush() 13 }, this.flushInterval) 14 }
36 private startTimer() { 37 this.el.classList.remove(`stopped`) 38 this.startTime = Date.now() 39 this.timerInterval = window.setInterval(() => { 40 const timeLeft = this.timeLeftMilliseconds() 41 if (timeLeft <= 0) { 42 this.stopTimer() 43 this.notifyCompletion() 44 } else { 45 this.displayTimeLeft(formattedTimeSeconds(timeLeft)) 46 } 47 }, updateInterval) 48 }
61 private startTimer() { 62 this.el.classList.remove(`stopped`) 63 this.startTime = Date.now() 64 this.timerInterval = window.setInterval(() => { 65 const timeLeft = this.timeLeftMilliseconds() 66 if (timeLeft <= 0) { 67 this.stopTimer() 68 this.notifyCompletion() 69 } else { 70 this.displayTimeLeft(formattedTimeSeconds(timeLeft)) 71 } 72 }, updateIntervalMs) 73 }
173 updateTimer () { 174 175 if ( this.intervalId ) clearInterval ( this.intervalId ); 176 177 if ( !this.itemProps.visibility ) return; 178 179 this.intervalId = setInterval ( this.updateText.bind ( this ), 1000 ); 180 181 }