concept merge() in category rxjs

appears as: merge()
RxJS in Action

This is an excerpt from Manning's book RxJS in Action.

Now you’ve entered into new, more sophisticated territory. This chapter is our point of inflection where we’ll look at combinatorial operators similar to combine-Latest() like merge(), switch(), concat(), and others to solve real-world, complex problems. Although there’s still a lot to gain from using observables to handle a single event source, like a single button click, in all but the most trivial of applications, you’ll quickly find that your logic will require more than a single stream to get the job done. You had a taste of this toward the end of chapter 4 when you implemented a slightly more complicated problem, which required you to combine and buffer the output of multiple streams.

The simplest operator that combines multiple streams together is merge(). It’s easy to understand; its purpose is to forward the events from several streams in order of arrival into one observable, like a funnel. Logically, you can think of merge as performing an OR of the two events, as shown in figure 5.2.

Figure 5.2. The merge() operator has no logic of its own, other than to combine events from multiple streams in the order in which they’re emitted.
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest