Skip to content

2.x: add sample() overload that can emit the very last buffered item#4955

Merged
akarnokd merged 1 commit intoReactiveX:2.xfrom
akarnokd:SampleWithTail
Jan 4, 2017
Merged

2.x: add sample() overload that can emit the very last buffered item#4955
akarnokd merged 1 commit intoReactiveX:2.xfrom
akarnokd:SampleWithTail

Conversation

@akarnokd
Copy link
Member

@akarnokd akarnokd commented Jan 4, 2017

The sample() operator in 1.x has been changed to always emit the very last buffered item before completion for 1.1.3: Discussion, PR.

This change has been forgotten in 2.x (because 2.x sample() was implemented several months earlier) but unlike 1.x, I don't want to break existing use cases, hence the introduction of 6 overloads (3 for each base type) that let's one define the "tail" behavior.

Note that the associated marble diagrams are inconsistent with the operators implemented, we need a new diagram where the timed-sample also emits the last value:

image

and one new diagram where the sampler-sample doesn't emit the last value:

image

The default sampler-sample should use this and the emitLast == true version can use the current diagram.

(I don't have a Mac thus can't run OmniGraffle).

Related: #4952

@akarnokd akarnokd added this to the 2.0 backlog milestone Jan 4, 2017
@codecov-io
Copy link

Current coverage is 95.57% (diff: 98.54%)

Merging #4955 into 2.x will decrease coverage by 0.15%

@@                2.x      #4955   diff @@
==========================================
  Files           587        587          
  Lines         37551      37669   +118   
  Methods           0          0          
  Messages          0          0          
  Branches       5655       5675    +20   
==========================================
+ Hits          35950      36003    +53   
- Misses          676        704    +28   
- Partials        925        962    +37   

Powered by Codecov. Last update 19fac95...9c7f28d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants