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

There is a bug in _.throttle function #2589

Closed
lessfish opened this issue Sep 15, 2016 · 3 comments
Closed

There is a bug in _.throttle function #2589

lessfish opened this issue Sep 15, 2016 · 3 comments

Comments

@lessfish
Copy link
Contributor

lessfish commented Sep 15, 2016

I use like below:

function log() {
  console.log('hello world');
}
window.onscroll = _.throttle(log, 1000, {leading: false, trailing: false});

when scrolling the window for the first time, its behaviour is right, but when for the second time, it will immediately print hello world in the console, although we have set leading to false.

Thanks.

@lessfish
Copy link
Contributor Author

I'm sorry but nobody? I think it's a real issue

@akre54
Copy link
Collaborator

akre54 commented Sep 20, 2016

Why are both leading and trailing false? One of them should be true.

@lessfish
Copy link
Contributor Author

@akre54 thanks for your replay. Maybe it's true, I have tried lodash, when used in this way, it does not trigger the callback function.

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

No branches or pull requests

2 participants