Chapter 2
Manipulating Streams

In the last chapter, you learned how to create observables with new Observable, along with a few of the helper operators Rx provides. You also peeked into the world of manipulating values in an observable stream with the magic of map. While mapping is a common pattern, the Rx library has many other operators for working with in-stream data. In fact, most Rx work is about manipulating the data as it comes down the stream. This change can be in the form of manipulating the data directly (map), changing the timing of the data (delay), or operating on the observables themselves (takeUntil).

This chapter expands your knowledge of the types of map functions available and adds several new types of operators to your tool belt:

  • mergeMap combines flattening and mapping into a single operation.
  • filter allows a stream to be picky about what values are allowed.
  • The tap operator is a unique case that doesn’t manipulate the stream’s values directly, but allows a developer to tap into the stream and debug it.

The first of two projects in this chapter is a Pig Latin translator. Through this translator, you’ll learn how to manipulate values as they pass through an observable stream. The second project, a typeahead tool, takes the concepts from the Pig Latin translator and builds a more complicated tool out of them, teaching you how to debug in-flight data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.13.192