このページは大阪弁化フィルタによって翻訳生成されたんですわ。

翻訳前ページへ


chrome.idle - Google Chrome
The Wayback Machine - http://web.archive.org/web/20130323082855/http://developer.chrome.com/extensions/idle.html

chrome.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"
  ],
  ...
}

chrome.idle reference

Methods

queryState

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

Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.

Parameters

detectionIntervalInSeconds ( integer )
The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.
callback ( function )

Callback function

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

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

setDetectionInterval

chrome.idle.setDetectionInterval(integer intervalInSeconds)

Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.

Parameters

intervalInSeconds ( integer )
Threshold, in seconds, used to determine when the system is in an idle state.

Events

onStateChanged

chrome.idle.onStateChanged.addListener(function(enumerated string ["active""idle""locked"] newState) {...});

Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system.

Listener Parameters

newState ( enumerated string ["active""idle""locked"] )

Sample Extensions that use chrome.idle

  • Idle - Simple Example – Demonstrates the Idle API