Add support for `trailing:false`
- Lenguaje dominante
- TypeScript
- Estrellas
- 229
- Forks
- 18
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 2
Descripción
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 |
```
Guía de contribución
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 58/100