Event Flashcards
1
Q
EventTarget.addEventListener()
A
adds a listener to the event target
params: type, listener[, useCapture]
type
event type to listen for (e.g. click)
listener
an object that implements EventListener, or a function
useCapture
captures the event on the way down (instead of waiting for it to bubble)
2
Q
EventTarget.removeEventListener()
A
removes a listener
params: type, listener[, useCapture]
Note: useCapture must match. It is possible to have two listeners that are the same except for this flag.
3
Q
EventTarget.dispatchEvent()
A
dispatches an event at the event target, calling all of the listeners
params: event