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 to use less naïve timing #7

Open
henryqdineen opened this issue Mar 1, 2018 · 0 comments
Open

Update throttle to use less naïve timing #7

henryqdineen opened this issue Mar 1, 2018 · 0 comments

Comments

@henryqdineen
Copy link
Contributor

See conversation in #6

const tfn = throttle(100, fn)
tfn(); // fn();
// 99 ms later
tfn(); // setTimeout(fn, 100)

In this case the functions are executed 199ms apart while ideally you would want 100ms. I see that lodash/underscore versions of throttle are a little more intelligent about the delay provided to setTimeout.

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

1 participant