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

add support for debouncing leading event #185

Merged
merged 1 commit into from
Mar 23, 2015

Conversation

ahamid
Copy link
Contributor

@ahamid ahamid commented Mar 23, 2015

debounceDelay only applies to subsequent events, not the initial event, which is always immediately fired. In the case that you want to wait for completion of initial activity on a file (e.g. sequential auto-saves in an editor), it's beneficial to debounce the leading event. This patch introduces debounceLeading which does just that - the leading event will not be fired immediately, but at the end of the debounce timeout.

Related issue is: #142

Debouncing the leading event (essentially forcing trailing event emission) coincidentally solve the above problem as well, however there is probably a more general way to solve both issues (see Underscore semantics of debounce and throttle with leading/trailing).

This patch has not been tested on master, but identical patch passes (existing) tests on 0.5.1.

@shama
Copy link
Owner

shama commented Mar 23, 2015

I wish how events got debounced/throttled was handled by the user as I don't want to rebuild those existing libs. But I can't think of a better way to handle it atm so merging this option. Thanks!

shama added a commit that referenced this pull request Mar 23, 2015
add support for debouncing leading event
@shama shama merged commit b011567 into shama:master Mar 23, 2015
@tremby
Copy link

tremby commented May 26, 2015

Please provide some documentation for this.

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.

3 participants