I have two RxJS subjects, say a
and b
that I need to combine somehow.
someComboOfAandB.subscribe({aVal, bVal} => console.log("value:", aVal, bVal));
I want to combine them such that if a
and b
are updated synchronously, the values are delivered together:
a.next(1);
// some code
b.next(2)
// at end of synchronous code / frame:
// value: 1 2
However, if just one value is updated, an update will still be pushed at the same time an update with two new values would be pushed:
a.next(5)
// at end of synchronous code / frame:
// value: 5 2
Is this possible? If it is, how so? Even if it is possible, is it something that should be avoided?