chore: remove deprecated APIs (#18159)
This commit is contained in:
parent
96e19f1cc4
commit
019b31d084
7 changed files with 35 additions and 126 deletions
|
@ -19,14 +19,6 @@ Object.setPrototypeOf(App.prototype, EventEmitter.prototype)
|
|||
EventEmitter.call(app as any)
|
||||
|
||||
Object.assign(app, {
|
||||
// TODO(codebytere): remove in 7.0
|
||||
setApplicationMenu (menu: Electron.Menu | null) {
|
||||
return Menu.setApplicationMenu(menu)
|
||||
},
|
||||
// TODO(codebytere): remove in 7.0
|
||||
getApplicationMenu () {
|
||||
return Menu.getApplicationMenu()
|
||||
},
|
||||
commandLine: {
|
||||
hasSwitch: (theSwitch: string) => commandLine.hasSwitch(String(theSwitch)),
|
||||
getSwitchValue: (theSwitch: string) => commandLine.getSwitchValue(String(theSwitch)),
|
||||
|
|
|
@ -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