I would like to create an observable which takes N observable sources and transform them whith an N-ary function. The onNext() of this observable will call this function whenever one of the source observables emits an item, like this: f(null,null,null,o3.val,null,null) where o3 is the source which just emitted a value.
Is like the combineLatest where the f is called with the last emitted values from all the sources combined together but here in the f we get null value for all the others.
The body of the f could act like a switch:
function f(v1,v2,...vn) {
if (v1) { ... }
else if(v2) { ... }
}
Is this possible? There are other way round for accomplish this behaviour?
null
s but only at the index of the source Observable that just emitted you want its value? – martinn
observables that you combine into a single array of values and then you use a series ofif
statements to choose a code path based on the value emitted. Why not just haven
observables withn
subscriptions to the code you need? – Enigmativitymerge
? – Asti