Open pbadenski opened 5 years ago
Hey and thanks @pbadenski. I like the idea, but wondering if flush should be scheduled using a setTimeout
instead? If I understand your implementation correctly, the debounced function will now have to be called in order to check for maxWait
to have passed, but maxWait may have already passed at that time.
e.g. using wait=1000, maxWait=4000
time (ms) ->
0 1000 2000 3000 4000 5000
|--------|--------|--------|--------|--------|
x x x x x x x x x x x
^--- should have flushed here
^--- but will flush here
Implements #11