Module: playerapi/core/DeviceContext

This context provides methods for handling the current device.

Members

<inner> cancelEvent

Cancel the event and prevent it from bubbeling thru the element hirachy.
Example: document.onClick = cancelEvent;

Methods

<inner> attachFirstSupportedEvent(element, eventNames, callback) → {String}

Attach the event handler handler for the first supported event specified by eventNames
to the element jqObject.
Example: attachFirstSupportedEvent( myObject, "pointerdown mousedown touchend", myHandler );

Parameters:
Name Type Description
element HTMLElement

the element for attaching the event callback

eventNames String

a space separated list of event names, without the "on"-prefix

callback function
Returns:

the event name or ""

Type
String

<inner> hasPointerEventSupport() → {boolean}

Returns true if the device can handle pointer events.

Returns:

true if the device can handle pointer events, false otherwise.

Type
boolean

<inner> hasTouchScreen() → {boolean}

Checks the device for touch screen input.

Returns:

true if the current device uses a touch screen as input device.

Type
boolean

<inner> removeFirstSupportedEvent(element, eventNames, callback) → {String}

Remove attached event handler handler for the first supported event specified by eventNames
from the element jqObject.
Example: removeFirstSupportedEvent( myObject, "pointerdown mousedown touchend", myHandler );

Parameters:
Name Type Description
element HTMLElement

the element to remove the event callback from

eventNames String

a space separated list of event names, without the "on"-prefix

callback function
Returns:

the event name or ""

Type
String