Idle
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
Idle
Manifest
You must declare the "idle" permission in your extension's manifest to use the idle API.
For example:
{
"name": "My extension",
...
"permissions": [
"idle"
],
...
}
API reference: chrome.idle
Properties
getLastError
chrome.extensionlastError
Methods
queryState
void
chrome.idle.queryState(, integer
thresholdSeconds, function
callback)
Undocumented.
Returns the current state of the browser.
Parameters
-
thresholdSeconds
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- Threshold, in seconds, used to determine when a machine is in the idle state.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(string newState) {...};
-
newState
(
optional
enumerated
Type
array of
string
["active", "idle", "locked"]
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
Events
onStateChanged
chrome.idle.onStateChanged.addListener(function(string newState) {...});
Undocumented.
Fired when the browser changes to an active state. Currently only reports the transition from idle to active.
Parameters
-
newState
(
optional
enumerated
Type
array of
string
["active"]
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-