Class: Sphoords

Sphoords

new Sphoords()

Sphoords class allowing to retrieve the current orientation of a device supporting the Orientation API.

Source:

Members

(static) isDeviceOrientationSupported

A boolean to know if device orientation is supported (true if it is, false otherwise).

Source:

Methods

(static) getScreenOrientation() → {string|null}

Retrieves the current screen orientation.

Source:
Returns:

Current screen orientation, null if not supported

Type
string | null

addListener(f) → {void}

Adds a function to execute when device orientation changes.

Parameters:
Name Type Description
f function

The handler function

Source:
Returns:
Type
void

getCoordinates() → {object}

Returns the current coordinates.

Source:
Returns:

Longitude/latitude couple

Type
object

getCoordinatesInDegrees() → {object}

Returns the current coordinates in degrees.

Source:
Returns:

Longitude/latitude couple

Type
object

getScreenOrientation() → {string|null}

Returns the current screen orientation.

Source:
Returns:

The screen orientation (portrait-primary, portrait-secondary, landscape-primary, landscape-secondary) or null if not supported

Type
string | null

isEventAttached() → {boolean}

Determines whether Device Orientation Event is attached.

Source:
Returns:

true if event is attached, false otherwise

Type
boolean

start() → {boolean}

Attaches the DeviceOrientation event to the window and starts the record, only if Device Orientation is supported.

Source:
Returns:

true if event is attached, false otherwise

Type
boolean

stop() → {void}

Stops the record by removing the event handler.

Source:
Returns:
Type
void

toggle() → {void}

Toggles the recording state.

Source:
Returns:
Type
void