Search⌘ K
AI Features

Assembling the Stopwatch

Explore how to assemble a stopwatch application by integrating multiple RxJS observables and handling events with subscriptions. Understand using TypeScript to specify HTML elements, applying operators like takeUntil to manage event lifecycles, and separating business logic from UI. This lesson guides you through creating a responsive stopwatch that efficiently manages event streams and updates the view.

Stopwatch application

All three observables have been created. Now it’s time to assemble everything into an actual program.

Bud1
x.html
index.htmlIlocblob;(ΓΏΓΏΓΏΓΏΓΏΓΏpackage-lock.jsonIlocblobΒ©(ΓΏΓΏΓΏΓΏΓΏΓΏpackage.jsonIlocblob(ΓΏΓΏΓΏΓΏΓΏΓΏpackage.json.sb-a48e3b48-LE4G1wIlocblob˜ÿÿÿÿÿÿstopwatch-complete.tsIlocblobΒ…(ΓΏΓΏΓΏΓΏΓΏΓΏstopwatch.tsIlocblobΓ³(ΓΏΓΏΓΏΓΏΓΏΓΏ
tsconfig.jsonIlocblob;˜ÿÿÿÿÿÿwebpack.config.jsIlocblob©˜ÿÿÿÿÿÿ @Β€ @Β€ @Β€ @E
DSDB `Β€ @Β€ @Β€ @
Stopwatch application project

πŸ™‹β€β™‚οΈ Joe asks: What does that <HTMLElement> mean?

This course uses TypeScript for all the examples. The <angle bracket notation> denotes the specific return type for querySelector. TypeScript knows that querySelector will return some kind of element. In this case, we know specifically that we’re querying for an element of the HTML variety, so we use this syntax to override the generic element. With that override, TypeScript now knows that resultsArea has properties specific to an HTMLElement, such as ...