whale.idle

Description: Use the whale.idle API to detect when the machine's idle state changes.
Availability: Since Chrome 20.
Permissions: "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"
        ]**,
        ...
      }
      
## Summary | Types | |---| | [IdleState](#type-IdleState) | | Methods | | [queryState](#method-queryState) − `whale.idle.queryState(integer detectionIntervalInSeconds, function callback)` | | [setDetectionInterval](#method-setDetectionInterval) − `whale.idle.setDetectionInterval(integer intervalInSeconds)` | | Events | | [onStateChanged](#event-onStateChanged) |
## Types
### IdleState | Enum | |---| | `"active"`, `"idle"`, or `"locked"` |
## Methods
### queryState
`whale.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 | |---| | integer | detectionIntervalInSeconds | Since Chrome 25. The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected. | | function | callback | The _callback_ parameter should be a function that looks like this: `function( [IdleState](/extensions/idle#type-IdleState) newState) {...};` | [IdleState](/extensions/idle#type-IdleState) | newState | | |---|---|---| |
### setDetectionInterval
`whale.idle.setDetectionInterval(integer intervalInSeconds)`
Since Chrome 25. 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 | |---| | integer | intervalInSeconds | Threshold, in seconds, used to determine when the system is in an idle state. |
## Events
### onStateChanged
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.
#### addListener
`whale.idle.onStateChanged.addListener(function callback)`
| Parameters | |---| | function | callback | The _callback_ parameter should be a function that looks like this: `function( [IdleState](/extensions/idle#type-IdleState) newState) {...};` | [IdleState](/extensions/idle#type-IdleState) | newState | | |---|---|---| |

results matching ""

    No results matching ""