Skip to content

fix: delay debounce until after wait milliseconds of quiet - #255

Open
DSeaStar wants to merge 1 commit into
dgilland:developfrom
DSeaStar:fix/debounce-trailing
Open

fix: delay debounce until after wait milliseconds of quiet#255
DSeaStar wants to merge 1 commit into
dgilland:developfrom
DSeaStar:fix/debounce-trailing

Conversation

@DSeaStar

Copy link
Copy Markdown

debounce is documented as delaying func until wait milliseconds have elapsed since the last call, matching lodash's trailing debounce. The implementation instead primed last_call to now - wait, so the first invocation ran immediately (throttle-like).

This schedules the call on a daemon threading.Timer. Further calls reset that timer; max_wait still forces an invocation so a continuous burst cannot delay forever. Subsequent calls return the last successful result, as before.

Fixes #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydash.debounce is instead throttling the function

1 participant