Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/idle/setdetectioninterval/index.md
6556 views
---
title: idle.setDetectionInterval() slug: Mozilla/Add-ons/WebExtensions/API/idle/setDetectionInterval page-type: webextension-api-function tags: - API - Add-ons - Extensions - Idle - Method - Non-standard - Reference - WebExtensions - setDetectionInterval browser-compat: webextensions.api.idle.setDetectionInterval
---

{{AddonSidebar()}}

Sets the interval, in seconds, used to determine when the system is in an idle state for {{WebExtAPIRef("idle.onStateChanged")}} events. The default interval is 60 seconds.

The detection interval is specific to the extension that calls the method. Changing the interval in one extension will not affect the detection interval in another extension.

Syntax

browser.idle.setDetectionInterval( intervalInSeconds // integer )

Parameters

  • intervalInSeconds

    • : integer. Threshold, in seconds, used to determine when the system is in an idle state. The minimum value you can supply here is 15.

Browser compatibility

{{Compat}}

Examples

browser.idle.setDetectionInterval(15);

{{WebExtExamples}}

Note: This API is based on Chromium's chrome.idle API. This documentation is derived from idle.json in the Chromium code.