# idle
Documentation: [Chrome Idle API](https://developer.chrome.com/docs/extensions/reference/idle)
A promise-based wrapper for the Chrome `idle` API to monitor user idle state.
## Methods
- [getIdleAutoLockDelay()](#getIdleAutoLockDelay)
- [queryIdleState(detectionIntervalInSeconds)](#queryIdleState)
- [setIdleDetectionInterval(intervalInSeconds)](#setIdleDetectionInterval)
## Events
- [onIdleStateChanged(callback)](#onIdleStateChanged)
---
### getIdleAutoLockDelay
```
getIdleAutoLockDelay(): Promise
```
Retrieves the number of seconds before the system auto-locks due to inactivity.
### queryIdleState
```
queryIdleState(detectionIntervalInSeconds: number): Promise
```
Queries the user's idle state within the specified detection interval.
### setIdleDetectionInterval
```
setIdleDetectionInterval(intervalInSeconds: number): void
```
Sets the interval, in seconds, used to detect idle state changes.
### onIdleStateChanged
```
onIdleStateChanged(
callback: (newState: chrome.idle.IdleState) => void
): () => void
```
Adds a listener that fires when the user's idle state changes. Returns an unsubscribe function.