idle

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

找出用户系统何时处于空闲,锁定或活动状态。

要使用此API,您需要具有“空闲”权限

类型

idle.IdleState

描述设备空闲状态的字符串。

函数

idle.queryState()
如果系统被锁定则返回“已锁定”,如果用户未在指定的秒数内生成任何输入,则返回“空闲”,否则返回“活动”。
idle.setDetectionInterval()
设置用于确定系统何时处于 idle.onStateChanged  事件的空闲状态的时间间隔。

事件

idle.onStateChanged
当系统改变状态时触发。

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
IdleStateChrome Full support YesEdge No support NoFirefox Full support 45Opera Full support YesFirefox Android Full support 48
onStateChangedChrome Full support YesEdge No support NoFirefox Full support 51Opera Full support YesFirefox Android Full support 51
queryStateChrome Full support YesEdge Full support 15Firefox Full support 45
Notes
Full support 45
Notes
Notes Before version 51, Firefox always reports 'active'. After version 51, Firefox reports 'active' or 'idle' as appropriate.
Opera Full support YesFirefox Android Full support 48
Notes
Full support 48
Notes
Notes Before version 51, Firefox always reports 'active'. After version 51, Firefox reports 'active' or 'idle' as appropriate.
setDetectionIntervalChrome Full support YesEdge Full support 15Firefox Full support 51Opera Full support YesFirefox Android Full support 51

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.
确认

此 API基于 Chromium 的 chrome.idle API。本文档源自 Chromium代码中的 idle.json

Microsoft Edge 兼容性数据由 Microsoft Corporation提供,并包含在Creative Commons Attribution 3.0 United States License下。

了解更多:

...