EventTarget

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

EventTarget es una interfaz implementada por los objetos que pueden administrar eventos y sus escuchadores.

Element, document, y window son los objetivos más comunes de un evento, pero otros objetos pueden serlo también, por ejemplo XMLHttpRequest, AudioNode, AudioContext, entre otros.

Muchos objetivos de eventos tales como: elementos, documentos y ventanas, también admiten la configuración de controladores de eventos a través de propiedades y atributos.

Métodos

EventTarget.addEventListener()

Registre un controlador de eventos de un tipo de evento específico en EventTarget.

EventTarget.removeEventListener()

Elimina un detector de eventos del EventTarget.

EventTarget.dispatchEvent()

Enviar un evento a este EventTarget.

Especificaciones

Specification
DOM
# interface-eventtarget

Compatibilidad con navegadores

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
EventTarget
EventTarget() constructor
addEventListener
Form with options object supported (third parameter can be either options or a Boolean, for backwards compatibility)
options.capture parameter
options.once parameter
options.passive parameter
options.passive parameter defaults to true for touchstart and touchmove events
options.passive parameter defaults to true for wheel and mousewheel events
options.signal parameter
useCapture parameter is optional
dispatchEvent
removeEventListener
Form with options object supported (third parameter can be either options or a Boolean, for backwards compatibility)
useCapture parameter is optional

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Has more compatibility info.

Vea también