OpenTV Player Web HTML5

Module: events

events

events.js

Members

inner _supportsPassive

Whether passive event listeners are supported

inner,constant passiveEvents

Touch events Chrome expects to be passive

Methods

staticmodule:events.any(elem, type, fn)

Trigger a listener only once and then turn if off for all configured events

Name Type Description
elem Element | Object

Element or object to bind to.

type string | Array.<string>

Name/type of event

fn Event~EventListener

Event listener function

staticmodule:events.fixEvent(event){Object}

Fix a native event to have standard property values

Name Type Description
event Object

Event object to fix.

Returns:
Type Description
Object Fixed event object.

staticmodule:events.off(elem, type, fn)

Removes event listeners from an element

Name Type Description
elem Element | Object

Object to remove listeners from.

type string | Array.<string> optional

Type of listener to remove. Don't include to remove all events from element.

fn function optional

Specific listener to remove. Don't include to remove listeners for an event type.

staticmodule:events.on(elem, type, fn)

Add an event listener to element It stores the handler function in a separate cache object and adds a generic handler to the element's event, along with a unique id (guid) to the element.

Name Type Description
elem Element | Object

Element or object to bind listeners to

type string | Array.<string>

Type of event to bind to.

fn function

Event listener.

staticmodule:events.one(elem, type, fn)

Trigger a listener only once for an event.

Name Type Description
elem Element | Object

Element or object to bind to.

type string | Array.<string>

Name/type of event

fn Event~EventListener

Event listener function

staticmodule:events.trigger(elem, event, hash){boolean|undefined}

Trigger an event for an element

Name Type Description
elem Element | Object

Element to trigger an event on

event EventTarget~Event | string

A string (the type) or an event object with a type attribute

hash Object optional

data hash to pass along with the event

Returns:
Type Description
boolean | undefined Returns the opposite of defaultPrevented if default was prevented. Otherwise, returns undefined

inner_cleanUpEvents(elem, type)

Clean up the listener cache and dispatchers

Name Type Description
elem Element | Object

Element to clean up

type string

Type of event to clean up

inner_handleMultipleEvents(fn, elem, types, callback)

Loops through an array of event types and calls the requested method for each type.

Name Type Description
fn function

The event method we want to use.

elem Element | Object

Element or object to bind listeners to

types Array.<string>

Type of event to bind to.

callback function

Event listener.