Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM
Practice: Observers
Implement IntersectionObserver and MutationObserver in an interactive panel
Task
In the index.html file the setupObservers() function creates two observers: an IntersectionObserver tracks whether the #radar section is at least half visible (threshold 0.5), and a MutationObserver recounts the alerts in the #alerts list. Fill in the blanks: ___BLANK1___ is the entry property that tells whether the element is visible now, and ___BLANK2___ is the observe() option that makes the MutationObserver react when list children are added or removed. The radar status should change together with its visibility, and the #alert-count counter should show the number of alerts after every button click.