developit / developit/decko

@debounce is named improperly — should be @throttle

未关闭
#9 4 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看
bug discussion help wanted
主要语言
JavaScript
星标
1k
派生
34
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。