Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Christmas story with Santa sleigh progress bar Reply To: Christmas story with Santa sleigh progress bar

#248852
Shikkediel
Participant

I think it turned out pretty neat too. Cool little function. This line’s very subtle but makes quite the difference:

if (!remain) executed = Date.now();

If you leave the if statement in, a debounce will not be treated as an execution of the original function. So even a millisecond after it, any user action will get triggered again. But if you leave it out, the function will keep throttling – by using this debounce as if it were a user event. Took me a bit to visualise, I have to say…

I’ve actually started to use it without the condition. It might best left in when the throttling time is relatively high.

Anywho, let me take the opportunity to get back to the original intent of the thread a bit and give everyone here the best wishes for the holidays.

:-)