I have read the throttleTime documentation, but I don't get the operator fully.
I know how throttleTime(1000)
works. After an event arrives it will skip all subsequent events for 1 second and then start this process again.
What I have trouble to understand is how exactly ThrottleConfig
works, which is the third parameter of the operator.
throttleTime<T>(
duration: number,
scheduler: SchedulerLike = async,
config: ThrottleConfig = defaultThrottleConfig): MonoTypeOperatorFunction<T>
How do leading
and trailing
properties change the functionality of the source Observable?
I have read many documentations but they don't clearly explain this.
So there are four options:
{ leading: true, trailing: false }
:
default option, after receiving event skips other events for specified duration and then repeat.{ leading: false, trailing: true }
:
???{ leading: false, trailing: false }
:
Tested this and the Observable doesn't emit anything at all.{ leading: true, trailing: true }
:
???