--- title: WakeLockSentinel slug: Web/API/WakeLockSentinel translation_of: Web/API/WakeLockSentinel ---
{{APIRef("Screen Wake Lock API")}}{{SeeCompatTable}}{{securecontext_header}}
The WakeLockSentinel interface of Screen Wake Lock API provides a handle to a platform wake lock used to prevent screen from turning off, dimming, or displaying a screen saver.
"screen".release event type which occurs when WakeLockSentinel object's handle has been releases due to either a release() method being called or because {{Glossary("User Agent")}} releases the lock.The following example acquires a screen wake lock and then releases it in 10 minutes:
function tryKeepScreenAlive(minutes) {
navigator.wakeLock.request("screen").then(lock => {
setTimeout(() => lock.release(), minutes * 60 * 1000);
});
}
tryKeepScreenAlive(10);
| 规范 | 状态 | Comment |
|---|---|---|
| Screen Wake Lock API | Editor's Draft | Initial specification. |
{{Compat("api.WakeLockSentinel")}}