Various utilities for managing the device the app is running on. In this context, the window size is also regarded as device information as not controlled by the app itself and more represents the environment in which it is running.
Classes
Methods
(static) enterFullscreen(elementopt, optionsopt)
Put the element into fullscreen mode.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
element |
Element |
<optional> |
Document.documentElement | The element to go into fullscreen. |
options |
Object |
<optional> |
(static) exitFullscreen()
Exit fullscreen mode.
(static) getDimensions(elementopt) → {Object}
Get the dimensions of an element.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
element |
Element |
<optional> |
window | Element to check. Defaults to the window. |
Returns:
- Type
- Object
(static) getScaleToCover(width, height, options) → {number}
Get an appropriate scale to allow a rectangle to cover the body. The body should have been set in css to fit the screen.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
width |
number | Rectangle width |
|||||||||
height |
height | Rectangle height |
|||||||||
options |
Object |
Properties
|
Returns:
- Type
- number
(static) getScaleToFit(width, height, options) → {number}
Get an appropriate scale to allow a rectangle to fit in the body. The body should have been set in css to fit the screen.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
width |
number | Rectangle width |
|||||||||
height |
height | Rectangle height |
|||||||||
options |
Object |
Properties
|
Returns:
- Type
- number
(static) getScaleToFitOrCover(width, height, cover, options) → {number}
Get an appropriate scale to allow a rectangle to fit in the body. Typically no element is provided and the body will have been set in css to fit the screen.
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
width |
number | Rectangle width |
|||||||||
height |
height | Rectangle height |
|||||||||
cover |
boolean | Should scale result in the rectangle covering the element or fitting within it. Fits if false. |
|||||||||
options |
Object |
Properties
|
Returns:
- Type
- number
(static) supportsTouch() → {boolean}
Test if touch api supported.
Returns:
- Type
- boolean
Type Definitions
KeyEventListener
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
callback |
function | Function to call on event |
noRepeat |
boolean | If true, key repeats are ignored. |
VirtualKeyDetail
Detail provided in the details property of the options object provided to the CustomEvent.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
key |
string | see the KeyboardEvent.key property. |