I saw you mentioned it the updated README that this could be an issue, and indeed I already ran into it and fixed it with this code.
In a long running countdown timer that was doing some intensive work (redrawing a canvas element) in its callback it actually caused some confusing display problems. It eventually would run all the missing ticks, but the timer counted down very quickly rather than just rendering the latest real value.
This will just immediately run the tick function when this.interval - diff is less than or equal to zeor, and it will adjust this.time appropriately for the ticks it missed.
I saw you mentioned it the updated README that this could be an issue, and indeed I already ran into it and fixed it with this code.
In a long running countdown timer that was doing some intensive work (redrawing a canvas element) in its callback it actually caused some confusing display problems. It eventually would run all the missing ticks, but the timer counted down very quickly rather than just rendering the latest real value.
This will just immediately run the tick function when
this.interval - diff
is less than or equal to zeor, and it will adjustthis.time
appropriately for the ticks it missed.