10 examples of 'javascript stop timer' in JavaScript

Every line of 'javascript stop timer' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
89stop() {
90 clearTimeout(this._timeout);
91 clearInterval(this._interval);
92}
108stop():void
109{
110 this.cancel();
111}
400stopTimer (name){
401 if (this.startTime){
402 this.stopTime = new Date();
403 this.time = (this.stopTime.getTime() - this.startTime.getTime());
404 this.logger( "TIMER "+ name + " execute in : "+ this.time/1000 + " s" ,"INFO" ) ;
405 }else{
406 return ;
407 }
408 this.startTime = null;
409}
89function stop() {
90 if (--lock.count) delete lock[id];
91 else delete node.__transition__;
92 return 1;
93}
36private 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}
61private 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}
44stop (): Timer {
45 if (!this.running) {
46 return this
47 }
48 window.clearInterval(this.timerId)
49 return (this
50 .remove('running')
51 .remove('start')
52 .remove('elapsed')
53 .remove('timerId'))
54}
26stop(message?: string) {
27 clearInterval(this._interval);
28 this.logTime(message || "completed");
29}
36stop() {
37 if (this.timer) {
38 clearInterval(this.timer);
39 }
40
41 this.startedAt = 0;
42 this.timer = null;
43
44 this.emit('stop');
45}
63public removeTimer(timer: Timer): void {
64 this._timersToDelete.push(timer);
65 timer.timerManager = null;
66}

Related snippets