by menssen · 7y ago · 0 comments
setInterval's minimum interval is ~15ms [1], so shouldn't something like...
setInterval(() => (new Date()).valueOf() % DESIRED_TICK_INTERVAL < 15 && tickTheMetronome(), 15)
...get you within 15ms accuracy, and it can probably be reduced in Chrome et al?
[1] http://www.adequatelygood.com/Minimum-Timer-Intervals-in-Jav...