Events

Events

Source:
Event related functions

Methods

(static) click(el)

Source:
Trigger a click event on the specified element
Parameters:
Name Type Description
el HTMLElement

(static) focus(el)

Source:
Set focus on the specified element
Parameters:
Name Type Description
el HTMLElement

(static) getEventTarget(e) → {EventTarget}

Source:
Return target event
Parameters:
Name Type Description
e Event
Returns:
Type
EventTarget

(static) off(el, action, fn)

Remove an event listener from an element

Source:
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name Type Description
el Element | Document | Window | XMLHttpRequest
action String The event to remove
fn function Function to remove on the given event

(static) offAll(els, action, fn)

Source:
Remove an event listener from a collection of elements
Parameters:
Name Type Description
els Array.<(Element|Document|Window|XMLHttpRequest)> | NodeList.<(Element|Document|Window|XMLHttpRequest)>
action String The event to remove
fn function Function to remove on the given event

(static) on(el, action, fn)

Set an event listener on an element

Source:
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name Type Description
el Element | Document | Window | XMLHttpRequest
action String The event to listen to
fn function Function to execute when event triggers

(static) onAll(els, action, fn)

Source:
Set an event listener on a collection of elements
Parameters:
Name Type Description
els Array.<(Element|Document|Window|XMLHttpRequest)> | NodeList.<(Element|Document|Window|XMLHttpRequest)>
action String The event to listen to
fn function Function to execute when event triggers

(static) once(el, action, fn)

Set an event listener that triggers once on an element

Source:
Most of the time on, off, all and once will be used with one of Element, Window or XMLHttpRequest But other DOM objects (like AudioContext) implement EventTarget interface (addEventListener is used under the hood) and can be valid parameters
Parameters:
Name Type Description
el Element | Document | Window | XMLHttpRequest
action String The event to listen to
fn function Function to execute when event triggers

(static) preventDefault(e)

Source:
Prevent default event from happening
Parameters:
Name Type Description
e Event

(static) ready(fn)

Source:
Trigger a function when DOM is ready
Parameters:
Name Type Description
fn function