Only allow a value through if a minimum amount of time has elapsed.
since the last value. This effectively slows down a source to a given number
of values/ms. Values emitted by the source which are too fast are discarded.
Throttle will fire on the first value received.
In more detail:
Every time throttle passes a value, it records the time it allowed something through. For every
value received, it checks the elapsed time against this timestamp, throwing away values if
the period hasn't elapsed.
With this logic, a fury of values of the source might be discarded if they fall within the elapsed time
window. But then if there is not a new value for a while, the actual duration between values can be longer
than expected. This is in contrast to debounce, which will emit the last value received after a duration,
even if the source stops sending.
Only allow a value through if a minimum amount of time has elapsed. since the last value. This effectively slows down a source to a given number of values/ms. Values emitted by the source which are too fast are discarded.
Throttle will fire on the first value received.
In more detail: Every time throttle passes a value, it records the time it allowed something through. For every value received, it checks the elapsed time against this timestamp, throwing away values if the period hasn't elapsed.
With this logic, a fury of values of the source might be discarded if they fall within the elapsed time window. But then if there is not a new value for a while, the actual duration between values can be longer than expected. This is in contrast to debounce, which will emit the last value received after a duration, even if the source stops sending.