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

@debounce is named improperly — should be @throttle #9

Open
ivancuric opened this issue Mar 29, 2017 · 4 comments
Open

@debounce is named improperly — should be @throttle #9

ivancuric opened this issue Mar 29, 2017 · 4 comments

Comments

@ivancuric
Copy link

ivancuric commented Mar 29, 2017

In the docs its says:

To debounce means "call this at most once per N ms". All outward function calls get collated into a single inward call, and only the latest (most recent) arguments as passed on to the debounced function.

What you're doing is throttling, not debouncing.
lodash.throttle:

Creates a throttled function that only invokes func at most once per every wait milliseconds.

lodash.debounce:

Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.

And while on the topic, a (real) @debounce would be a great addition.

@developit
Copy link
Owner

Agreed! It's a difficult thing to change now that its there, but what about adding an option and making the default an actual debounce? @pl12133 called this out to me a couple weeks ago, I'd forgotten about the name mixup.

@ivancuric
Copy link
Author

The sooner you do it the better if you see a future for this package. We have enough misnamed "oh-it's-too-late-now" stuff in the web dev industry as it is :)

Anyway, decided to use https://www.npmjs.com/package/core-decorators instead for the project I'm working on since I do need both. The implementations are quite similar as well.

@developit
Copy link
Owner

Oh nice, I hadn't seen that module! Looks good.

@Connorelsea
Copy link

I'd love to have a real debounce option here somehow. Separating throttle and debounce would make a lot of sense. Also core-decorators seems to have deprecated their debounce and throttle decorators for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants