Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM
Exercise: Custom Events in a Monitoring System
Create a communication system between Jurassic Park modules using Custom Events with detail, bubbles, and dispatchEvent.
Task
In the index.js file the createMonitoring() function builds a control center with a paddock inside (the paddock is a child of the center) and returns sendAlert(zone, level) and reportStatus(dino, status). Fill in the blanks in sendAlert: ___BLANK1___ is the constructor of an event that carries data in detail, ___BLANK2___ is the option that lets the securityAlert event travel from the paddock up to the control center, and ___BLANK3___ is the method that sends the event from the paddock. Every alert should reach the center log as the text "zone: level", e.g. "A: high".