This article is in need of a technical review.
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
getWakeLockState method is used to retrieve the current lock state of a given resource.
- A string that represent the name of the resource to check.
This method will return a string that represents the current lock state for the resource. Possible values for this state are:
- Nobody holds the wake lock.
- At least one window holds the wake lock and is visible.
- At least one window holds the wake lock, but all of them are hidden.
var state = navigator.mozPower.getWakeLockState('screen') console.log('screen: ' + state);
Not part of any specification.