Building a Stopwatch

Enough theory—you’re probably itching to start building something. The first project you’ll take on in this book is a stopwatch that contains three observables. The stopwatch will have two buttons, one for starting and one for stopping, with an observable monitoring each. Behind the scenes will be a third observable, ticking away the seconds since the start button was pressed in increments of 1/10th of a second. This observable will be hooked up to a counter on the page. You’ll learn how to create observables that take input from the user, as well as observables that interact with the DOM to display the latest state of your app.

Before we get to the code, take a second to think about how you’d implement this without Rx. ...

Get Build Reactive Websites with RxJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.