10 examples of 'javascript stop setinterval' in JavaScript

Every line of 'javascript stop setinterval' 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
this disclaimer
44function setInterval(callback, delay, var_args) {};
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

89stop() {
90 clearTimeout(this._timeout);
91 clearInterval(this._interval);
92}
24function setInterval(callback, duration) {
25 if(!callback) return;
26
27 var id = window.timerID++;
28 var info = {id:id, callback:callback};
29
30 info.duration = duration/1000;
31 info.timeout = window.tickTime + info.duration;
32
33 window.intervalFuncs[id] = info;
34
35 return id;
36}
15export default function scheduleUpdate(update, dt) {
16 let _handle
17
18 if (dt === undefined) {
19 return null
20 } else {
21 _handle = setInterval(() => {
22 update(dt)
23 }, dt)
24 return {
25 unscheduleUpdate() {
26 clearInterval(_handle)
27 }
28 }
29 }
30}
14function setTimeInterval(time) {
15 resetTimeInterval();
16
17 currentTime = time;
18 setTimeText(currentTime);
19
20 interval = setInterval(function() {
21 currentTime -= 1000;
22 setTimeText(currentTime);
23
24 if (currentTime <= 0) {
25 clearInterval(interval);
26 }
27 }, 1000);
28}
350public setInterval(action: any, time: number): NodeJS.Timeout {
351 const interval: any = setInterval(action, time);
352
353 this.intervals.push(interval);
354
355 return interval;
356}
24function setInterval(handler,time){
25 if (isWeex){
26 timer.setInterval(handler,time);
27 return document.taskCenter.callbackManager.lastCallbackId.toString();
28 } else {
29 return window.setInterval(handler,time);
30 }
31}
362public clearInterval(interval: NodeJS.Timeout): boolean {
363 const index: number = this.timeouts.indexOf(interval);
364
365 if (index !== -1) {
366 clearTimeout(this.intervals[index]);
367 this.intervals.splice(index, 1);
368
369 return true;
370 }
371
372 return false;
373}
218_clearInterval() {
219 clearInterval(this._interval);
220 this._interval = null;
221}
29function SetInterval() {
30 this.key = {};
31
32 /**
33 * @param {Function} fn
34 * @param {Number} interval
35 * @param {String} key
36 */
37 this.start = function start(fn, interval, key) {
38 if (!this.key[key]) {
39 this.key[key] = setInterval(function () {
40 fn();
41 }, interval);
42 }
43 }
44
45 /**
46 * @param {String} key
47 */
48 this.clear = function clear(key) {
49 if (this.key[key]) {
50 clearInterval(this.key[key]);
51 delete this.key[key];
52 }
53 }
54}

Related snippets