You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
WARNING: This is the BETA documentation. It may not work with the stable release of Chrome.
WARNING: This is unofficial documentation. It may not work with the current release of Chrome.

Google Chrome Extensions (Labs)

Idle

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

Methods

queryState

chrome.idle.queryState(integer thresholdSeconds, function callback)

Returns the current state of the browser.

Parameters

thresholdSeconds
( integer )
Threshold, in seconds, used to determine when a machine is in the idle state.
callback
( function )
Undocumented.

Callback function

The callback parameter should specify a function that looks like this:

function(string newState) {...};
newState
( enumerated string ["active", "idle", "locked"] )
Undocumented.

Events

onStateChanged

chrome.idle.onStateChanged.addListener(function(string newState) {...});

Fired when the browser changes to an active state. Currently only reports the transition from idle to active.

Listener parameters

newState
( enumerated string ["active"] )
Undocumented.