SearchโŒ˜ K

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 .innerText. ...