Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: evenly distribute values on throttleTime(fn, {leading: true, trailing: true}) #4864

Closed
wants to merge 1 commit into from

Conversation

sod
Copy link

@sod sod commented Jun 17, 2019

fixes #2727
fixes #3712

reproduction (rxjs 6.5.1) https://stackblitz.com/edit/rxjs-tthiju

Look at the new test it('should handle a busy producer emitting a regular repeating sequence'

      const e1 =   hot('abcdeabcdeabcdeabcdea|');
      const expected = 'a----a----a----a----a|';

That should be the expected behavior for {leading: true, trailing: true}. Thats the same behavior of https://lodash.com/docs/4.17.11#throttle and https://underscorejs.org/#throttle as well.

Right now throttleTime does it more like:

      const e1 =   hot('abcdefabcdefabcdefabcdefa|');
      const expected = 'a----fa----fa----fa----fa|';

@sod
Copy link
Author

sod commented Jul 10, 2019

@benlesh it seem like I always come at the worst time ... when you prepare the next major version :D. But was there the possibility to include this in rxjs7?

@MatthiasKunnen
Copy link
Contributor

Is this not a duplicate of #4727?

@sod
Copy link
Author

sod commented Jul 15, 2019

Oh indeed it is. Haven't seen it. But #4727 schedules the timer after emitting the value. IMO it's important that scheduling always happens upfront, so user code (if slow) doesn't mess with the timings.

@sod
Copy link
Author

sod commented Sep 4, 2019

i give up again, I hope @MatthiasKunnen has more stamina

@sod sod closed this Sep 4, 2019
@MatthiasKunnen
Copy link
Contributor

I got you @sod. I wanna see this through.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants