Draft
This page is not complete.
Secure context
This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
The read-only type
property of the WakeLockSentinel
interface returns a String
representation of the currently acquired WakeLockSentinel
type.
Syntax
var type = WakeLockSentinel.type;
Value
A String
representation of the currently acquired wake lock type.
- type Read only
- Return values are:
'screen'
: A screen wake lock. Prevents devices from dimming or locking the screen.
Examples
This example shows an asynchronous function that acquires a WakeLockSentinel
, then logs the type to the console.
const requestWakeLock = async () => { wakeLock = await navigator.wakeLock.request('screen'); console.log(wakeLock.type); // logs 'screen' }; requestWakeLock();
Specifications
Specification | Status | Comment |
---|---|---|
Screen Wake Lock API The definition of 'WakeLockType' in that specification. |
Unknown | Initial definition. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
type | Chrome Full support 84 | Edge Full support 84 | Firefox No support No | IE No support No | Opera Full support Yes | Safari No support No | WebView Android Full support 84 | Chrome Android Full support 84 | Firefox Android No support No | Opera Android Full support Yes | Safari iOS No support No | Samsung Internet Android Full support Yes |
Legend
- Full support
- Full support
- No support
- No support