developit / developit/decko

@debounce is named improperly — should be @throttle

Open
#9 4 comments 10 reactions 0 assignees View on GitHub
bug discussion help wanted
Dominant language
JavaScript
Stars
1k
Forks
34
PR merge metrics
No merged PRs in 30d

Description

In the [docs](https://github.com/developit/decko#debounce) 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](https://lodash.com/docs/4.17.4#throttle):
> Creates a throttled function that only invokes `func` at most once per every `wait` milliseconds.

[lodash.debounce](https://lodash.com/docs/4.17.4#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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.