Chapter 2. Reacting with RxJS
Listing 2.1. Processing collections with map, reduce, and filter
Listing 2.2. Custom BufferIterator function
Chapter 3. Core operators
Listing 3.1. Disposing of an observable
Listing 3.2. Disposing of a promise
Listing 3.3. Mapping functions over streams
Listing 3.4. Filtering events from a stream
Listing 3.5. Using reduce() to compute spending
Chapter 4. It’s about time you used RxJS
Listing 4.1. Working with observables and setTimeout()
Listing 4.2. Creating a simple animation with an RxJS timer
Listing 4.3. Explicit time using JavaScript timing functions and RxJS
Listing 4.4. Simulating a simple stock ticker widget
Listing 4.5. Augmenting stock data with the time interval
Listing 4.6. Showcase the delay operator
Listing 4.7. delay shifts the entire observable sequence
Listing 4.8. Sequential delay operators
Listing 4.9. Manual debouncing logic for smart search widget
Listing 4.10. Dedicated debounce() method using vanilla JavaScript
Listing 4.11. Using custom debounce() method
Listing 4.12. A simple debounce-optimized search program
Listing 4.13. Controlling button action with throttle
Listing 4.14. Creating form field history with bufferWhen()
Listing 4.15. Buffering events for a specific period of time
Chapter 5. Applied reactive streams
Listing 5.1. Case matching event data resulting from merging mouse and touch streams
Listing 5.2. Normalizing upstream event data merges the streams
Listing 5.3. Reactive search solution
Listing 5.4. The request quote stream
Listing 5.5. Mapping one stream into another
Listing 5.6. Updating multiple stock symbols
Listing 5.7. Streams needed to implement drag and drop with a mouse
Chapter 6. Coordinating business processes
Listing 6.1. Hooking into the start of a stream
Listing 6.2. SessionDisposable object implementing the dispose functionality
Listing 6.3. Managing a temporary session token with using()
Listing 6.4. Synchronizing streams with combineLatest()
Listing 6.5. Combining multiple URL shortener streams
Listing 6.6. Bitly URL shortener stream
Listing 6.7. Google URL shortener stream
Listing 6.8. Using forkJoin to fetch multiple stock symbols simultaneously
Listing 6.9. Transaction class
Listing 6.10. Populating the database
Listing 6.11. Optimizing write operations using bulk writes
Listing 6.12. Two queries in a single stream declaration
Chapter 7. Error handling with RxJS
Listing 7.1. Function ajax() with success and error callbacks
Listing 7.2. Imperative error handling with asynchronous code
Listing 7.3. Promisified ajax()
Listing 7.4. Internals of the Try functional data type
Listing 7.5. Calling the error method on observers when an exception is thrown
Listing 7.6. Recovering from an exception using catch()
Listing 7.7. Implementing a linear backoff retry for our stock ticker stream
Listing 7.8. Fixed count, linear backoff, and throwing exception if error persists
Chapter 8. Heating up observables
Listing 8.2. Simple RxJS Node.js server
Listing 8.3. WebSocket client with RxJS
Listing 8.4. Stock ticker as event emitter
Listing 8.5. Complete stock ticker widget with change tracking
Chapter 9. Toward testable, reactive programs
Listing 9.1. First unit test of a pure function notEmpty
Listing 9.2. Using Mocha/Chai to test an asynchronous function
Listing 9.3. Asynchronous testing with Promises
Listing 9.4. Search stream used in the smart search component
Listing 9.5. Testing a stream that adds up all numbers of an array
Listing 9.6. Testing an observable with a delay
Listing 9.7. Testing a promise AJAX call within an observable
Listing 9.8. Publishing values on an async scheduler
Listing 9.9. Testing the map() operator
Listing 9.10. Testing the debounceTime operator
Listing 9.11. Speeding up runInterval() with the virtual time scheduler
Chapter 10. RxJS in the wild
Listing 10.1. A React account balances that updates every second
Listing 10.2. Communicating to child components using a single parent
Listing 10.3. Simple banking form with checking text field and withdraw button
Listing 10.4. Multiple subscriptions with subjects
Listing 10.5. Build a promise-like operator with subjects
Listing 10.6. Plugging into the middleware
Listing 10.7. Implementing custom ofType operator