Event & Event Handling
The EventTarget
interface is implemented by objects that can react to certain events [MDN, samthor.au].
A script can create an event using the Event
constructor. Such an event is called synthetic event (unlike native events that are dispatched by the browser). To actually fire the event, dispatchEvent
is used. [MDN]
A CustomEvent
is similar to an Event
with the difference that it may have a detail
property on the event options. That can be used to pass additional information regarding the event to a listener. [MDN]
Handlers for native events are executed asynchronously. Custom events that are fired with dispatchEvent
are executed synchronously. [MDN]