groupJoin - richardszalay/raix GitHub Wiki
Combines values from two streams based on the βlifetimeβ of each value, represented by an IObservable selected for each value. Each left value is sent a selector along with an IObservable of potential future right value matches. The output of this selector is emitted to the output stream.
rightWindowSelector : Function, joinSelector : Function) : IObservableleftWindowSelector is function(leftValue : TLeft) : IObservable.<*>
rightWindowSelector is function(rightValue : TRight) : IObservable.<*>
joinSelector is function(leftValue : TLeft, rightValue : IObservable.<TRight>) : IObservable.<TResult>
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 are sent to the joinSelector along with an IObservable of potential right values; any right values that are still active when a left window begins are immediately emitted to the βright valuesβ IObservable 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ββ/
βββ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
```