With the new CustomEvent() directive, we can create a new, named event to use in our program. Sometimes, user interactions or page behavior don't fully handle what we need. Custom events can help with that need. Notice in the preceding code that the detail object contains data to be passed with the event, and we use document.dispatchEvent() to send it to the event stream. Creating an event listener for a custom event is the same as doing so with a built-in event: use .addEventListener(). We'll want to use the doMove() function.





















































