Event

In programming and software design, an event is an action or occurrence recognized by software, often originating asynchronously from the external environment, that may be handled by the software. Computer events can be generated or triggered by the system, by the user, or in other ways. Typically, events are handled synchronously with the program flow. That is, the software may have one or more dedicated places where events are handled, frequently an event loop. The user can be the source of an event. The user may interact with the software through the computer's peripherals - for example, by typing on a keyboard or clicking with a mouse. Another source is a hardware device such as a timer. Software can also trigger its own set of events into the event loop, such as by communicating the completion of a task. Software that changes its behavior in response to events is said to be event-driven, often with the goal of being interactive.

The Event interface represents an event which takes place on an EventTarget. An event can be triggered by the user action e.g. clicking the mouse button or tapping keyboard, or generated by APIs to represent the progress of an asynchronous task. It can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. Many DOM elements can be set up to accept (or "listen" for) these events, and execute code in response to process (or "handle") them.

Event-handlers are usually connected (or "attached") to various HTML elements, such as button, div, span. etc. using EventTarget.addEventListener(), and this generally replaces using the old HTML event handler attributes.

Further, when properly added, such handlers can also be disconnected if needed using removeEventListener().

https://en.m.wikipedia.org/wiki/Event_(computing) HEIGHT 500 Wikipedia