Javascript - How to do get accurate the timer delay of setinterval? -
this question has answer here:
- setinterval delays not accurate 2 answers
i having problem delay of setinterval follows:
var playball = setinterval(function() { // code here // measure offset time console.log('time: ' + new date().gettime()); }, 20);
when execute, delay actual 21 or 22 or more than...which not 20 milliseconds.
where problem?
it's commonly known setinterval() method isn't accurate.
see link find out how method works: https://dzone.com/articles/how-javascript-timers-work
Comments
Post a Comment