Build Reactive Websites with RxJS

Book description

Upgrade your skillset, succeed at work, and above all, avoid the many headaches that come with modern front-end development. Simplify your codebase with hands-on examples pulled from real-life applications. Master the mysteries of asynchronous state management, detangle puzzling race conditions, and send spaceships soaring through the cosmos. When you finish this book, you'll be able to tame the wild codebeasts before they ever get a chance to wreck your day.

The front-end world can be fraught with complexity. The RxJS library offers a solution: Observables. Observables merge other JavaScript asynch mechanisms such as callbacks and promises into a new way of looking at data. Instead of dealing with objects and keeping track of their state, Observables view asynchronous events as a stream. RxJS provides you the tools to manage, manipulate, and process Observables to simplify and speed up your front-end applications.

Never fear, you're in exactly the right place. Don't worry about getting stuck in a mire of theory. Start off with the basics, building small applications that illustrate deeper points. Take those building blocks and apply them to much more complex problems like handling asynchronous state and dodging race conditions before they happen. Once you've got a handle on complex problems, take a leap into architecture, discovering how to structure an Observable-based application both without a framework and in the land of Angular 2. After mastering Observables, switch gears to building a canvas-based game, demonstrating your deep understanding of the flexibility of Observables.

Master the Observable with RxJS, and make your asynchronous JavaScript code that much cleaner and simpler.

What You Need:

Any major browser and text editor, as well as the current versions of git, NodeJS, and npm.

Publisher resources

View/Submit Errata

Table of contents

  1.  Introduction
    1. The Goal of This Book
    2. But I Already Use (Insert Framework Here)!
    3. How to Read This Book
    4. Setting Up the Environment
    5. Online Resources
    6. Acknowledgments
  2. 1. Creating Observables
    1. Introducing Rx Concepts
    2. Building a Stopwatch
    3. Using a Subscription
    4. Experimenting with Observables
    5. What We Learned
  3. 2. Manipulating Streams
    1. Translating Pig Latin with Flatten and Reduce
    2. Flattening
    3. Reducing
    4. Debugging an Observable Stream
    5. Typeahead
    6. What We Learned
  4. 3. Managing Asynchronous Events
    1. Making AJAX Requests
    2. Handling Errors
    3. Promises vs. Observables with AJAX
    4. Loading with Progress Bar
    5. When Good AJAX Goes Bad
    6. Progressive and Ordered Loading
    7. What We Learned
  5. 4. Advanced Async
    1. The Spec
    2. Preventing Race Conditions with switchMap
    3. Debouncing Events
    4. Adding Debounce to the Typeahead
    5. Building a Stock Ticker
    6. What We’ve Learned
  6. 5. Multiplexing Observables
    1. The Problem with Cold Observables
    2. Multicasting with the Subject Class
    3. Building a Chat Room
    4. What We Learned
  7. 6. Using HTTP in Angular
    1. Generating a New Project
    2. Displaying Returned Data
    3. Saving New Data
    4. Routing to Components
    5. Linking Between Components
    6. Editing a Single Photo
    7. Adding in Analytics
    8. Intercepting HTTP Calls
    9. What We Learned
  8. 7. Building Reactive Forms in Angular
    1. Building a Phone Number Input
    2. Creating a Phone Input with Angular
    3. Validating an Input
    4. Building a Pizzeria Registration Form
    5. Using Advanced Validation
    6. Creating a Pizza Ordering Form
    7. What We Learned
  9. 8. Advanced Angular
    1. Building Performant Applications
    2. Managing State with ngrx
    3. What We Learned
  10. 9. Reactive Game Development
    1. Creating Your Own Operator
    2. Animating Objects
    3. Calling next with Schedulers
    4. Architecting a Game
    5. Tracking User Input
    6. Creating Enemies
    7. Detecting Collisions
    8. What We Learned
    9. Bonus Points

Product information

  • Title: Build Reactive Websites with RxJS
  • Author(s): Randall Koutnik
  • Release date: December 2018
  • Publisher(s): Pragmatic Bookshelf
  • ISBN: 9781680502954