The Join
operator combines the items emitted by two Observables, and selects which items to
combine based on duration-windows that you define on a per-item basis. You implement these windows as
Observables whose lifespans begin with each item emitted by either Observable. When such a window-defining
Observable either emits an item or completes, the window for the item it is associated with closes. So long as
an item’s window is open, it will combine with any item emitted by the other Observable. You define the
function by which the items combine.
Most ReactiveX implementations that have a Join
operator also have a GroupJoin
operator that is similar, except that the function you define to combine items emitted by the two Observables
pairs individual items emitted by the source Observable not with an item from the second Observable, but with
an Observable that emits items from the second Observable that fall in the same window.
TBD
TBD
The join
operator takes four parameters:
join
join
does not by default operate on any particular Scheduler.
Join(Observable,Func1,Func1,Func2)
The groupJoin
operator takes four parameters:
groupJoin
groupJoin
does not by default operate on any particular
Scheduler.
Note that there is also a join
operator in the optional StringObservable
class.
It converts an Observable that emits a sequence of strings into an Observable that emits a single string
that concatenates them all, separating them by a specified string delimiter.
The join
operator takes four parameters:
join
join
does not by default operate on any particular Scheduler.
Join(Observable,Func1,Func1,Func2)
The groupJoin
operator takes four parameters:
groupJoin
groupJoin
does not by default operate on any particular
Scheduler.
Note that there is also a join
operator in the optional StringObservable
class.
It converts an Observable that emits a sequence of strings into an Observable that emits a single string
that concatenates them all, separating them by a specified string delimiter.
The join
operator takes four parameters:
join
var xs = Rx.Observable.interval(100) .map(function (x) { return 'first' + x; }); var ys = Rx.Observable.interval(100) .map(function (x) { return 'second' + x; }); var source = xs .join( ys, function () { return Rx.Observable.timer(0); }, function () { return Rx.Observable.timer(0); }, function (x, y) { return x + y; } ) .take(5); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
Next: first0second0 Next: first1second1 Next: first2second2 Next: first3second3 Next: first4second4 Completed
The groupJoin
operator takes four parameters:
groupJoin
ar xs = Rx.Observable.interval(100) .map(function (x) { return 'first' + x; }); var ys = Rx.Observable.interval(100) .map(function (x) { return 'second' + x; }); var source = xs.groupJoin( ys, function () { return Rx.Observable.timer(0); }, function () { return Rx.Observable.timer(0); }, function (x, yy) { return yy.select(function (y) { return x + y; }) }).mergeAll().take(5); var subscription = source.subscribe( function (x) { console.log('Next: ' + x); }, function (err) { console.log('Error: ' + err); }, function () { console.log('Completed'); });
Next: first0second0 Next: first1second1 Next: first2second2 Next: first3second3 Next: first4second4 Completed
join
and groupJoin
are found in each of the following distributions:
rx.all.js
rx.all.compat.js
rx.coincidence.js
TBD