feat: Add new powerMonitor synchronous API (#17144)

`powerMonitor.querySystemIdleState` and `powerMonitor.querySystemIdleTime` had async backing APIs in chromium (https://chromium-review.googlesource.com/c/chromium/src/+/1379183). However, that has changed in ch73. So, this PR deprecates the old async APIs and adds new sync APIs.
This commit is contained in:
Nitish Sakhawalkar 2019-02-27 12:54:01 -08:00 committed by John Kleinschmidt
commit bfa07ec4be
7 changed files with 96 additions and 25 deletions

View file

@ -63,6 +63,24 @@ require('path')
require('electron').remote.require('path')
```
## `powerMonitor.querySystemIdleState`
```js
// Deprecated
powerMonitor.querySystemIdleState(threshold, callback)
// Replace with synchronous API
const idleState = getSystemIdleState(threshold)
```
## `powerMonitor.querySystemIdleTime`
```js
// Deprecated
powerMonitor.querySystemIdleTime(callback)
// Replace with synchronous API
const idleTime = getSystemIdleTime()
```
# Planned Breaking API Changes (5.0)
## `new BrowserWindow({ webPreferences })`