Add support for `trailing:false`
- 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
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