Once you set the interval, it persists. There's no way to revert to the default interval. There's no way to read the current interval.
It would be nice to expose the default value, like so:
browser.idle.DEFAULT_INTERVAL_IN_SECONDS = 60
Similarly, there's no mention of the interval's minimum.
await chrome.idle.queryState(10) throws (at least in Chrome)
Uncaught TypeError: Error in invocation of idle.queryState(integer detectionIntervalInSeconds, function callback):
Error at parameter 'detectionIntervalInSeconds': Value must be at least 15.
It would be nice to expose:
browser.idle.MINIMUM_INTERVAL_IN_SECONDS = 15
Currently, I have to program defensively and wrap each setDetectionInterval and queryState call into try/catch, in case the minimum interval constant changes.
TL;DR: the default interval is not exposed so to revert it back to the initial value you have to hardcode the number from the documentation.
from: https://developer.chrome.com/docs/extensions/reference/idle/#method-setDetectionInterval (similar page on mdn)
Once you set the interval, it persists. There's no way to revert to the default interval. There's no way to read the current interval.
It would be nice to expose the default value, like so:
Similarly, there's no mention of the interval's minimum.
await chrome.idle.queryState(10)
throws (at least in Chrome)It would be nice to expose:
Currently, I have to program defensively and wrap each setDetectionInterval and queryState call into try/catch, in case the minimum interval constant changes.