草案
此页面不完整。
安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
onrelease
特性为
WakeLockSentinel
is fired when the sentinel object's handle has been released.
A
WakeLockSentinel
can be released manually via the release() method, or automatically via the platform wake lock. This can happen if the document becomes inactive or looses visibility, if the device is low on power or the user turns on a power save mode.
This interface inherits from the
事件
接口。
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 8.571428571428571%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="../API/WakeLockSentinel" target="_top"><rect x="1" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">WakeLockSentinel</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
wakeLockSentinel.onrelease = function(event) {...}
This example updates the UI should the wake lock be released.
wakeLock.addEventListener('release', () => {
// if wake lock is released alter the UI accordingly
statusElement.textContent = 'Wake Lock has been released';
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
Screen Wake Lock API
The definition of 'onrelease' in that specification. |
未知 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
onrelease
|
Chrome 84 | Edge 84 | Firefox No | IE No | Opera Yes | Safari No | WebView Android 84 | Chrome Android 84 | Firefox Android No | Opera Android Yes | Safari iOS No | Samsung Internet Android Yes |
完整支持
不支持
实验。期望将来行为有所改变。