rxjs icon indicating copy to clipboard operation
rxjs copied to clipboard

[docs]: Operator `throttleTime` is missing an example for the throttleConfig param

Open BioPhoton opened this issue 6 years ago • 3 comments

Documentation Related To Component:

The throttleTime operator: throttleTime.ts

Please check those that apply

  • [ ] typo
  • [ ] documentation doesn't exist
  • [x] documentation needs clarification
  • [ ] error(s) in example
  • [x] needs example

We may want to include a description for throttleConfig param. Also, the see also section is incomplete.

Description

The detailed description can be improved. Here we should include that:

  • there is an optional config param

See Also

We miss some operators in the see also section.

A suggested list for related operators could look like this:

 * @see {@link delay}
 * @see {@link delayWhen}
 * @see {@link audit}
 * @see {@link auditTime}
 * @see {@link debounce}
 * @see {@link debounceTime}
 * @see {@link sample}
 * @see {@link sampleTime}
 * @see {@link throttle}

BioPhoton avatar Mar 16 '19 15:03 BioPhoton

Would it make sense to also mention that configurability in the description?

Current description totally disregards that:

Emits a value from the source Observable, then ignores subsequent source values for duration milliseconds, then repeats this process.

We could add something to mention that, e.g.

Can be configured to ignore the first value and|or also emit the last value within given duration.

I personally missed that option, probably due to rather strict description of the behavior.

kosich avatar May 30 '19 12:05 kosich

The new throttleTime behavior with { leading: true, trailing: true } is not documented, neither in the operator page (https://rxjs.dev/api/operators/throttleTime) nor in the v7 breaking changes page. The operator marble image also still shows the old behavior, where both the last and the first event is emitted, even if the time between them is smaller than the throttle time. I noticed the new behavior through unit testing.

Nosfistis avatar Jun 23 '21 22:06 Nosfistis

Same issue, the graph shows image

while the api is throttleTime<T>(duration: number, scheduler: SchedulerLike = asyncScheduler, config?: ThrottleConfig): MonoTypeOperatorFunction<T>

https://rxjs.dev/api/operators/throttleTime

CroMarmot avatar May 14 '23 20:05 CroMarmot