github / github/mini-throttle

Add support for `trailing:false`

未关闭
#36 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
229
派生
18
平均合并
1 天 10 小时
30 天内合并 PR
2

描述

The current default behavior is for two quick calls to result in two slow calls: one leading call and one trailing call. This is often not desirable - the point of throttling is to _reduce_ the number of calls, not just to slow them down. For this we would need a `trailing` option to control trailing edge calls:

```
| fn() | 1 2 3 4 |
| throttle(fn, 100) | 1 3 4 |
| throttle(fn, 100, {trailing: false}) | 1 3 |
```

贡献指南

打开贡献指南

调研方向

首先阅读 throttle 的实现及其现有选项,然后检查当前针对 leading 和 trailing 调用的测试。为 issue 中所示的 trailing:false 行为添加覆盖,并验证 trailing 调用会被抑制,而 leading 调用仍会如图所示发生。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
tooling
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 发到你的邮箱

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