Add support for `trailing:false`
- Vorherrschende Sprache
- TypeScript
- Sterne
- 229
- Forks
- 18
- Ø Merge
- 1 T. 10 Std.
- Gemergte PRs (30 T.)
- 2
Beschreibung
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 |
```
Beitragsleitfaden
Rechercherichtung
Lies zunächst die throttle-Implementierung und ihre bestehenden Optionen, und sieh dir anschließend die aktuellen Tests für leading- und trailing-Aufrufe an. Füge Abdeckung für das im Issue gezeigte Verhalten von trailing:false hinzu und überprüfe, dass trailing-Aufrufe unterdrückt werden, während die leading-Aufrufe weiterhin wie dargestellt stattfinden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 58/100