只读 didTimeout property on the IdleDeadline interface is a Boolean value which indicates whether or not the idle callback is being invoked because the timeout interval specified when Window.requestIdleCallback() was called has expired.

didTimeout is true IdleDeadline 对象的 timeRemaining() method will return approximately 0.

Idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. Your callback will typically check the value of didTimeout if it needs to perform an action even if the browser is too busy to grant you the time; you should react by performing the needed task or, ideally, a minimal amount of work that can be done to keep things moving along, then schedule a new callback to try again to get the rest of the work done.

句法

var timedOut = IdleDeadline.didTimeout;
					

A Boolean which is true if the callback is running due to the callback's timeout period elapsing or false if the callback is running because the user agent is idle and is offering time to the callback.

范例

See our complete example in the article Cooperative Scheduling of Background Tasks API .

规范

规范 状态 注释
Cooperative Scheduling of Background Tasks Proposed Recommendation

浏览器兼容性

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
didTimeout Chrome 47 Edge 79 Firefox 55
55
Disabled ). To change preferences in Firefox, visit
IE 不支持 No Opera 34 Safari 不支持 No WebView Android 47 Chrome Android 47 Firefox Android 55
55
Disabled ). To change preferences in Firefox, visit
Opera Android 34 Safari iOS 不支持 No Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

用户必须明确启用此特征。

用户必须明确启用此特征。

另请参阅

元数据

  • 最后修改: