chore: remove deprecated APIs (#18159)

This commit is contained in:
Milan Burda 2019-05-09 20:48:10 +02:00 committed by John Kleinschmidt
parent 96e19f1cc4
commit 019b31d084
7 changed files with 35 additions and 126 deletions

View file

@ -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)),

View file

@ -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

View file

@ -1,5 +1,4 @@
import { EventEmitter } from 'events'
import { deprecate } from 'electron'
const binding = process.electronBinding('web_frame')
@ -46,26 +45,6 @@ class WebFrame extends EventEmitter {
get routingId () {
return binding._getRoutingId(this.context)
}
// Deprecations
// TODO(nitsakh): Remove in 6.0
setIsolatedWorldSecurityOrigin (worldId: number, securityOrigin: string) {
deprecate.warn('webFrame.setIsolatedWorldSecurityOrigin', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, { securityOrigin })
}
setIsolatedWorldContentSecurityPolicy (worldId: number, csp: string) {
deprecate.warn('webFrame.setIsolatedWorldContentSecurityPolicy', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, {
securityOrigin: window.location.origin,
csp
})
}
setIsolatedWorldHumanReadableName (worldId: number, name: string) {
deprecate.warn('webFrame.setIsolatedWorldHumanReadableName', 'webFrame.setIsolatedWorldInfo')
binding.setIsolatedWorldInfo(this.context, worldId, { name })
}
}
// Populate the methods.