Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure last event within debounceDelay window is emitted #231

Closed
wants to merge 2 commits into from

Conversation

bengourley
Copy link

I came up against the issue in #142 where the last change event is discarded. This ensures that the last event will fire after some are debounced.

I used the test that @motemen created in #142 but I found a simpler way to implement the logic.

In the grand schema of things I think debouncing/throttling should be left up to the user (re: your comments @shama #142 (comment)) but since this is already inside the module I thought I'd fix the bug. Feel free to remove everything later :)

@bengourley
Copy link
Author

I added another commit to implement the debounceImmediate: true|false option that decides whether an event should be emitted on the leading edge of the window (terminology borrowed from https://npm.im/debounce). This means that the internal debounce function is feature complete and usable. I set the default to true which means the existing behaviour is maintained.

@bengourley
Copy link
Author

Closing because of failing test on various platforms and lack of activity.

@bengourley bengourley closed this Aug 21, 2017
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.

1 participant