Get the Newsletter

addEventListener

A Method

addEventListener(eventName: string, callback: EventListenerOrEventListenerObject, capture?: boolean): void

Add a global event listener.

Parameters

eventName: string
A string representing the event type to listen for.
callback: EventListenerOrEventListenerObject
The function that receives a notification when an event of the specified type occurs.
capture?: boolean
If true, useCapture indicates that the user wishes to initiate capture.