Javascript - How to do get accurate the timer delay of setinterval? -


this question has answer here:

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

Popular posts from this blog

xml - Extract substrings with XSLT -

math - "ELO Rating" and how does "TSR Rating" work? -

How can do a tuple comparison in coffeescript similar to that in python? -