github / github/mini-throttle

Add support for `trailing:false`

Aperta
#36 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
229
Fork
18
Merge medio
1g 10h
PR unite (30g)
2

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
58/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.