feat(powerMonitor): expose interface to query system idle state (#11807)
* feat(BrowserWindow): expose interface to query system idle state * test(BrowserWindow): update test cases for querySystemIdle interface * docs(BrowserWindow): add querySystemIdle interface documentation * refactor(powerMonitor): move querySystemIdle into powerMonitor * test(powerMonitor): split test cases for all platform
This commit is contained in:
parent
90dc897f71
commit
e7181eb89c
5 changed files with 143 additions and 24 deletions
|
@ -46,3 +46,25 @@ Emitted when the system is about to reboot or shut down. If the event handler
|
|||
invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
|
||||
order for the app to exit cleanly. If `e.preventDefault()` is called, the app
|
||||
should exit as soon as possible by calling something like `app.quit()`.
|
||||
|
||||
## Methods
|
||||
|
||||
The `powerMonitor` module has the following methods:
|
||||
|
||||
#### `powerMonitor.querySystemIdleState(idleThreshold, callback)`
|
||||
|
||||
* `idleThreshold` Integer
|
||||
* `callback` Function
|
||||
* `idleState` String - Can be `active`, `idle`, `locked` or `unknown`
|
||||
|
||||
Calculate the system idle state. `idleThreshold` is the amount of time (in seconds)
|
||||
before considered idle. `callback` will be called synchronously on some systems
|
||||
and with an `idleState` argument that describes the system's state. `locked` is
|
||||
available on supported systems only.
|
||||
|
||||
#### `powerMonitor.querySystemIdleTime(callback)`
|
||||
|
||||
* `callback` Function
|
||||
* `idleTime` Integer - Idle time in seconds
|
||||
|
||||
Calculate system idle time in seconds.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue