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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

EventTarget.dispatchEvent()

A

dispatches an event at the event target, calling all of the listeners

params: event

How well did you know this?
1
Not at all
2
3
4
5
Perfectly