join - richardszalay/raix GitHub Wiki
ο»ΏCombines values from two streams based on the βlifetimeβ of each value, represented by an IObservable selected for each value. All combinations of values from both streams that occur during this βlifetimeβ window are sent to a selector to be combined. The output of this selector is emitted to the output stream.
function join(right : IObservable, leftWindowSelector : Function,
rightWindowSelector : Function, joinSelector : Function) : IObservableleftWindowSelector is function(leftValue : TLeft) : IObservable.<*>
rightWindowSelector is function(rightValue : TRight) : IObservable.<*>
resultSelector is function(leftValue : TLeft, rightValue : TRight) : IObservable.<TResult>
See also [groupJoin]
Similar to a cartesion join, but instead of joining on a value it joins on βtimeβ with the active lifetime for the two sequences are selected by leftWindowSelector and rightWindowSelector. Values from the left and right that are both βaliveβ at the same time are sent to βjoinSelectorβ, the result of which is emitted from the sequence.
The sequence completes when no further matches can logically occur.
The sequence errors if either the left or right sequences error or any of the lifetime windows error.
vs, ls = left (source)
rs = right
lws = leftWindowSelector
lws = rightWindowSelector
f() = joinSelector(left, right)
"i" = lifetime of i
ys = output
0 4
ls βββoβββββββββββoββββ
β β
β 1 2 3 β
rs ββββββoββoββoβ/β
β β β β β
"0" ββββΌβββΌ/ β β
"4" β β β βββββ
"1" ββββΌ/ β β
"2" β ββββΌβββΌβββ/
"3" β β ββββΌβ¬/ β
β β β ββ β
f f f ff β
β β β ββ β
ys ββββββoββoββoββooββ/In the above example 0 and 4 are emitted (at different times) from the left sequence and 1, 2 and 3 are emitted from the right sequence. Values 1 and 2 occur within 0βs lifetime so are emitted via resultSelector. Value 4 is emitted during 2 and 3βs lifetime, so two more values are emitted (4,2 and 4,3). The sequence completes after 2βs lifetime ends because the right sequence has already completed and there are no more active right values so no more combinations can occur.
IObservable.<TResult>
```as3
```