JavaScripture
Contribute via GitHub Feedback

JavaScript EventTarget : Object

Instance Methods

addEventListener 2 variants
addEventListener(type : String, listener : Function, [useCapture : Boolean]) : undefined
listener(event : Event) : undefined

Adds listener to the list of callbacks called when the specified event is fired. If useCapture is true, listener will be called in the capture phase of the event routing (ie, during the walk down the tree to the target instead of on the way up after firing on the target). Unlike using the on<type> style of listening to events, addEventListener allows more than one listener to be associated with the event. Use removeEventListener() to stop listening to the event.

Example:

Run

Results:

 

addEventListener(type : String, listener : EventListener, [useCapture : Boolean]) : undefined
dispatchEvent(event : Event) : Boolean
removeEventListener 2 variants
removeEventListener(type : String, listener : Function, [useCapture : Boolean]) : undefined
listener(event : Event) : undefined
removeEventListener(type : String, listener : EventListener, [useCapture : Boolean]) : undefined