2- the debounce leading option implementation is faulty as far as I understand it. IMO, it should execute the callback function immediately and not allow any further execution of the callback during the delayms time... Instead, it executes the callback immediately once and then again at the end of the delay...
I'm trying to use the
Timer.debounce
andTimer.throttle
functions. I'm facing several issues:1- The throttle and debounce functions do not allow arguments for the callback function, unlike its lodash counterpart...
2- the debounce
leading
option implementation is faulty as far as I understand it. IMO, it should execute the callback function immediately and not allow any further execution of the callback during thedelayms
time... Instead, it executes the callback immediately once and then again at the end of the delay...Here is a description of how it should behave.
3- the throttle implementation never reset the
waiting
flag to false, making it never callable again even afterdelayms
...