Episode 8 - zip vs combineLatest in RxJS Monday, 6 Nov.
❚ combineLatest, we need a project function that combines two values (or more) into a new one. I note it figuratively
⚬ ⟶ ⚭ ⟵ ⚬.
Let’s compare those two cards. In the following example, they both take the exact same arguments (the same input streams and the same project function):
As you can see,
❚ zip produces the first combined value only when both input streams have all emitted their first value. More generally, this is how
❚ zip operates with two (or more) input streams:
- It waits for all input streams to have all emitted their n-th value
- As soon as this condition is met, it combines all those n-th values and emits the n-th combined value
- As a result, it returns a new stream of combined events
❚ combineLatest combines values whenever any input stream emits a value,
❚ zip only combines each n-th values together.
In the combining streams category, you now have the following cards: