Defining Custom Events
Custom Events are events that are not predefined under javascript and activate during certain conditions that you build yourself.
Creating Custom Events
To create custom events, you use the 'event' constructor as the variable. Then, it can be built using syntax like: (let, const, var) event = new CustomEvent(EventName, (opt.CustomEvent)). To trigger an event you use dispatchEvent().
Why DOM Custom Events are used
DOM Custom Events are used when you want code triggered under certain conditions that isn't available as a built in event.
Summary
DOM Custom Events activate when you want events that are not already predefined under javascript (onclick, onchange, etc.). You create events using syntax like: (let, const, var) event = new CustomEvent(EventName, (opt.CustomEvent)), and then triggers when you use dispathcEvent().