addListener
AddListener is a method used in event-driven programming to register a function, or listener, to be invoked when a specified event occurs. The listener typically receives an event object or data and runs in response to the event. The API commonly accepts the event name or type and a callback function. Many frameworks allow multiple listeners for a single event and invoke them in a defined order when the event is emitted or dispatched. Some environments also provide a once variant that automatically removes the listener after the first invocation, and a separate removeListener or off function to detach listeners.
In Node.js, the EventEmitter class defines addListener as an alias of on; both register a listener for
In web browsers, the standard approach is addEventListener, which serves the same purpose for DOM events. Some