Use date timestamp rather than a counter to calculate time remaining
Opened this issue · 0 comments
Theblockbuster1 commented
Example:
let timer = setInterval(function() {
var delta = Date.now() - start; // milliseconds elapsed since start
if (delta >= timeToReach) {
clearInterval(timer);
}
}, 100);