chore: remove deprecated APIs (#18159)
This commit is contained in:
parent
96e19f1cc4
commit
019b31d084
7 changed files with 35 additions and 126 deletions
|
@ -4,7 +4,6 @@ import { createLazyInstance } from '../utils'
|
|||
|
||||
const { EventEmitter } = require('events')
|
||||
const { createPowerMonitor, PowerMonitor } = process.electronBinding('power_monitor')
|
||||
const { deprecate } = require('electron')
|
||||
|
||||
// PowerMonitor is an EventEmitter.
|
||||
Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype)
|
||||
|
@ -26,23 +25,4 @@ if (process.platform === 'linux') {
|
|||
})
|
||||
}
|
||||
|
||||
// TODO(nitsakh): Remove in 7.0
|
||||
powerMonitor.querySystemIdleState = function (threshold: number, callback: Function) {
|
||||
deprecate.warn('powerMonitor.querySystemIdleState', 'powerMonitor.getSystemIdleState')
|
||||
if (typeof threshold !== 'number') throw new Error('Must pass threshold as a number')
|
||||
if (typeof callback !== 'function') throw new Error('Must pass callback as a function argument')
|
||||
|
||||
const idleState = this.getSystemIdleState(threshold)
|
||||
process.nextTick(() => callback(idleState))
|
||||
}
|
||||
|
||||
// TODO(nitsakh): Remove in 7.0
|
||||
powerMonitor.querySystemIdleTime = function (callback: Function) {
|
||||
deprecate.warn('powerMonitor.querySystemIdleTime', 'powerMonitor.getSystemIdleTime')
|
||||
if (typeof callback !== 'function') throw new Error('Must pass function as an argument')
|
||||
|
||||
const idleTime = this.getSystemIdleTime()
|
||||
process.nextTick(() => callback(idleTime))
|
||||
}
|
||||
|
||||
module.exports = powerMonitor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue