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

update throttle and debounce description based on lodash docs #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

webkonstantin
Copy link

  • update throttle and debounce description based on lodash docs
  • add additional options for throttle and debounce provided by lodash (leading, trailing and maxWait)
  • update README
  • clean PR

Allows specifying behaviour described in this issue #25 using --debounce-leading option

…ditional options for throttle and debounce provided by lodash

var debounceOpts = createDebounceOpts(opts);
var debouncedRun = _.debounce(throttledRun, opts.debounce, debounceOpts);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens here when you pass the throttled function to debounce?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing throttled function to debounce was not introduced by me in this PR, but in this commit by ElliotChong and merged before
kimmobrunfeldt/chokidar-cli@609228b#diff-168726dbe96b3ce427e7fedce31bb0bcR142

I believe it combines debounce (execute after specified ms have elapsed since the last time the debounced function was called) and throttle (do not execute more than once in specified timeframe) behaviour as you would expect without any negative side-effects.

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.

2 participants