10 examples of 'set time interval in jquery' in JavaScript

Every line of 'set time interval in jquery' 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
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}
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

49setTimeout(function setUpdateInterval() {
50 updateUI();
51 updateInterval = window.setInterval(function updating() {
52 updateUI();
53 }, 60000);
54}, (60 - date.getSeconds()) * 1000);
116function set_interval(a,b)
117{
118 if( This.timer_callback)
119 {
120 console.error('only one timer can be active at a time. please `clearInterval` before setting a new one.');
121 return;
122 }
123 This.timer_callback = a;
124 This.target_interval = b;
125 This.timer = setInterval(frame, This.target_interval*0.5);
126 return This.timer;
127}
18function setTimer(timer, callback, interval) {
19 timers[timer.id] = {
20 callback,
21 interval,
22 lastRun: gameTime
23 };
24}
37calculateTimerInterval() {
38 if (this.props.stop > this.props.start) {
39 return (this.props.stop - this.props.start) / 1000;
40 }
41
42 // This is technically an error, but it's not a serious one or one that we should expose to the user, so we
43 // ignore it
44 return 0;
45}
11function settime(obj) {
12 if (countdown == 0) {
13 obj.removeAttribute("disabled");
14 obj.value = "免费获取验证码";
15 countdown = 60;
16 return;
17 } else {
18 obj.setAttribute("disabled", true);
19 obj.value = "重新发送(" + countdown + ")";
20 countdown--;
21 }
22 setTimeout(function () {
23 settime(obj)
24 }, 1000)
25}
11function setChartDuration(interval) {
12 var duration = '3000'; // base duration value
13 if (interval == '15m') {
14 duration = '15000';
15 } else if (interval == '1h') {
16 duration = '60000';
17 } else if (interval == '1d') {
18 duration = '300000';
19 } else if (interval == '7d') {
20 duration = '1800000';
21 } else if (interval == '30d') {
22 duration = '43200000';
23 } else if (interval == 'at') {
24 duration = '1800000';
25 }
26 return duration;
27}
148function time(that, wait){
149 if (wait == 0) {
150 $(that).removeClass('disabled').prop('disabled',false);
151 $(that).html('重新发送验证码');
152 } else {
153 $(that).html(wait+'秒后重新发送');
154 wait--;
155 setTimeout(function(){
156 time(that, wait);
157 }, 1000);
158 }
159}
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}
70set(): void {
71 if (this.isSet) {
72 this.clear(false);
73 }
74 this._intervalId = setInterval(() => this._action(), this._intervalMs);
75}

Related snippets