草案
此页面不完整。

安全上下文
此特征只可用于 安全上下文 (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.
未知 初始定义。

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

元数据

  • 最后修改: