The read-only 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.
If didTimeout
is true
, the IdleDeadline
object's 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.
Syntax
var timedOut = IdleDeadline.didTimeout;
Value
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.
Example
See our complete example in the article Cooperative Scheduling of Background Tasks API.
Specifications
Specification | Status | Comment |
Cooperative Scheduling of Background Tasks | Proposed Recommendation |
Browser compatibility
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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
didTimeout
|
Chrome
Full support 47 |
Edge
Full support 79 |
Firefox Full support 55 Full support 55 Full support 53 Disabled' From version 53: this feature is behind the |
IE
No support No |
Opera
Full support 34 |
Safari
No support No |
WebView Android
Full support 47 |
Chrome Android
Full support 47 |
Firefox Android Full support 55 Full support 55 Full support 53 Disabled' From version 53: this feature is behind the |
Opera Android
Full support 34 |
Safari iOS
No support No |
Samsung Internet Android
Full support 5.0 |
Legend
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
See also
- Collaborative Scheduling of Background Tasks
IdleDeadline
Window.requestIdleCallback()
Window.cancelIdleCallback()
IdleDeadline.didTimeout by Mozilla Contributors is licensed under CC-BY-SA 2.5.