Questions Tagged [Setinterval]
Ask Question setInterval Is a Global Javascript Method. It Is Used to Execute a Particular Function or Piece of Code at Regular Intervals. 1,182 Questions with...
setInterval is a global JavaScript method. It is used to execute a particular function or piece of code at regular intervals.
Must Read
1,182
questions with no upvoted or accepted answers
5
votes
0
answers
3k
views
I am getting [Violation] 'setInterval' handler took N ms warning in chrome dev and after that application get freezed
On running a setInterval call I am getting this issue.
[Violation] 'setInterval' handler took ms
In my understanding we get this issue when we write a code inside setInterval which takes more time to ...
5
votes
1
answer
412
views
Why history.js uses setInterval(.., 250)?
From what I understand History.js is a polyfill for HTML5 History/State APIs. Therefore, on modern browsers, it should simply use popstate for listening to URL changes. So, why on latest Chrome I can ...
4
votes
0
answers
389
views
Set Interval is not running in background when using workerTimers
I have developed a countdown timer using setInterval. But, it's getting paused in some cases (When keeping the browser tab or browser window in the background), hence not accurate. So, I used worker-...
4
votes
2
answers
122
views
the api block gets called 2 times, leads in rendering component twice, though conditions are getting checked properly
I am using 3 dynamic variable inside setInterval,
in state
this.state={
checked: true,
currentHash:"some current hash",
updating: true
}
inside componentDidMount, i've done ...
4
votes
3
answers
3k
views
Keep the JS/jQuery code working in Safari when the tab is not active
I have a JS/jQuery code as shown below in which in which I want to keep the JS/jQuery code working when the session tab is not active.
The following code perfectly fine in Google Chrome but it doesn't ...
4
votes
0
answers
304
views
Is it appropriate to use setInterval to perform repeated tasks? (NodeJS)
I want to execute a repeated task in every two hours in a Node JS app.
Is it efficient to use setInterval(function() {...}, 7200000) to do this or is it suggested to use maybe a module to achieve ...
4
votes
0
answers
842
views
React js change State in an instance of map() generated component
Question about React 16 from newbie.
React v16. I'm doing map() over tasks. Each task has its own timer component.
Parent:
render(props)
{
return (
this.props.tasks.tasks.map((task, id) ...
4
votes
0
answers
2k
views
setInterval accuracy in javascript
For fun, I've built a simple simulation of a drum machine in JavaScript. (You can try it at .)
I'm wondering if there's anything I can do to improve the accuracy of setInterval(...)....
4
votes
1
answer
3k
views
Safari delay setInterval / setTimeout (interval > 1000ms) in background tab
Just notice that Safari 10.0.3 delay my code when the page is in a background tab.
var interval = 2000;
var scriptTime = new Date().getTime();
function addTime(){
scriptTime += interval;
...
4
votes
0
answers
2k
views
setInterval running slow on Safari
I'm working on an HTML5 canvas-based game, and have hit a bit of a problem in Safari (on Windows).
The game runs nicely in Firefox and Chrome, and even IE, but on Safari everything moves really ...
4
votes
2
answers
5k
views
how to replace setInterval by requestAnimationFrame
Here is my situation, I need to speed up the function running time, so setInterval is not a wise choose, right? Since it will cost at least 4ms for each time.
So, may I change setInterval function to ...
3
votes
0
answers
91
views
React - setInterval() behaving differently on mobile browser
I am perplexed on an issue I am facing. I have developed a MERN app, where one component within the app is displaying data as a chart from my redux store. In order to give some semblance of "...
3
votes
0
answers
427
views
Browser stops making AJAX requests after period of inactivity
I've created an empty HTML page with a simple setInterval() that fires an AJAX call, via window.fetch(), every 30 seconds, indefinitely. In Chrome, however, if I leave my computer for 24 hours and ...
3
votes
0
answers
229
views
In setInterval , asynchronous function are getting in queue and making app freezes by memory leak, in javascript
In setInterval , asynchronous function are getting in queue and making app freezes by memory leak, in javascript
//Below the function that's i am using.
setIntervalsForServices = async (
forkDevice, ...
3
votes
0
answers
343
views
autoselect time from timepicker if current time match with timepicker values, every 5 minutes compare current time with time picker
I am using timepicker jquery plugin and it will show time with interval of 5 minutes, now my requirement is check current time and if current time match with time picker values than timepicker value ...