developit/decko

@debounce is named improperly — should be @throttle

Open

#9 建立於 2017年3月29日

在 GitHub 查看
 (4 留言) (10 反應) (0 負責人)JavaScript (34 fork)github user discovery
bugdiscussionhelp wanted

倉庫指標

Star
 (1,037 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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.

貢獻者指南