github / github/mini-throttle

Add support for `trailing:false`

Open
#36 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
229
Forks
18
Avg merge
1d 10h
Merged PRs (30d)
2

Description

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 |
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the throttle implementation and its existing options, then inspect the current tests for leading and trailing calls. Add coverage for the trailing:false behavior shown in the issue and verify that trailing calls are suppressed while the leading calls still occur as illustrated.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.