Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
throttle function has bigger delays than it should #820
I found this minor bug when trying to make a demo to visualize throttle and debounce:
In certain cases, it will skip a execution and waits more (double wait time) than necessary.
I tracked it down to this scenario:
When executing a throttle'd function, there are 2 setTimeouts executed almost simultaneously
The problem is that later() will trigger a whenDone() also (aka, that same _.debounce)
Then, it can happen two things with that second _.debounce:
I continue the bug report with an example in this text file that doesn't break the format: