|
|
|
|
|
by menssen
2475 days ago
|
|
I don't know the answer to this, but I've always been genuinely curious: how accurate is the Date object? 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... |
|