Every line of 'angular 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.
44 function setInterval(callback, delay, var_args) {};
24 function 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 }
29 function 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 }
25 setInterval (interval) { 26 this.options.interval = interval 27 return this; 28 }
43 setInterval(callback, intervalMs) { 44 this.callbacks.push(callback); 45 }
24 function 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 }
11 export function setInterval(callback, milliseconds){ 12 milliseconds = $__ToInteger(milliseconds); 13 if (typeof callback !== 'function') { 14 callback = $__ToString(callback); 15 } 16 return $__SetTimer(callback, milliseconds, true); 17 }
1 function adaptiveSetInterval(fn, runNow) { 2 // unconditionally run every minute 3 setInterval(fn, 60000); 4 5 // scheduleRun() keeps calling fn and decreasing quota 6 // every 3 seconds, until quota runs out. 7 var quota = 0; 8 var scheduledId = null; 9 function scheduleRun() { 10 if (quota > 0) { 11 quota -= 1; 12 clearTimeout(scheduledId); 13 scheduledId = setTimeout(scheduleRun, 3000); 14 fn(); 15 } 16 } 17 18 document.addEventListener("visibilitychange", function() { 19 if (document.visibilityState == "visible") { 20 // tab becomes visible: reset quota 21 if (quota == 0) { 22 quota = 20; 23 scheduleRun(); 24 } else { 25 quota = 20; 26 } 27 } else { 28 // lost visibility, clear quota 29 quota = 0; 30 } 31 }); 32 33 // user moves mouse: reset quota 34 document.addEventListener("mousemove", function() { 35 if (quota == 0) { 36 quota = 20; 37 scheduleRun(); 38 } else { 39 quota = 20; 40 } 41 }); 42 43 if (runNow) { 44 quota = 20; 45 scheduleRun(); 46 } 47 }
14 function 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 }
50 startInterval() { 51 this.interval = window.setInterval(() => { 52 this.fetch(getUrl(this.props.match.params.runId)) 53 }, interval) 54 }