Remove deprecated APIs
This commit is contained in:
parent
0cf50b1c0b
commit
dae68be2ce
9 changed files with 2 additions and 121 deletions
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const electron = require('electron')
|
||||
const {deprecate, session, Menu} = electron
|
||||
const {session, Menu} = electron
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
|
||||
const bindings = process.atomBinding('app')
|
||||
|
@ -63,61 +63,10 @@ for (i = 0, len = ref1.length; i < len; i++) {
|
|||
fn(ref1[i])
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
app.getHomeDir = deprecate('app.getHomeDir', 'app.getPath', function () {
|
||||
return this.getPath('home')
|
||||
})
|
||||
app.getDataPath = deprecate('app.getDataPath', 'app.getPath', function () {
|
||||
return this.getPath('userData')
|
||||
})
|
||||
app.setDataPath = deprecate('app.setDataPath', 'app.setPath', function (path) {
|
||||
return this.setPath('userData', path)
|
||||
})
|
||||
app.resolveProxy = deprecate('app.resolveProxy', 'session.defaultSession.resolveProxy', function (url, callback) {
|
||||
return session.defaultSession.resolveProxy(url, callback)
|
||||
})
|
||||
deprecate.rename(app, 'terminate', 'quit')
|
||||
deprecate.event(app, 'finish-launching', 'ready', function () {
|
||||
// give default app a chance to setup default menu.
|
||||
setImmediate(() => {
|
||||
this.emit('finish-launching')
|
||||
})
|
||||
})
|
||||
deprecate.event(app, 'activate-with-no-open-windows', 'activate', function (event, hasVisibleWindows) {
|
||||
if (!hasVisibleWindows) {
|
||||
return this.emit('activate-with-no-open-windows', event)
|
||||
}
|
||||
})
|
||||
deprecate.event(app, 'select-certificate', 'select-client-certificate')
|
||||
if (process.platform === 'win32') {
|
||||
app.isAeroGlassEnabled = deprecate('app.isAeroGlassEnabled', 'systemPreferences.isAeroGlassEnabled', function () {
|
||||
return electron.systemPreferences.isAeroGlassEnabled()
|
||||
})
|
||||
} else if (process.platform === 'darwin') {
|
||||
app.isDarkMode = deprecate('app.isDarkMode', 'systemPreferences.isDarkMode', function () {
|
||||
return electron.systemPreferences.isDarkMode()
|
||||
})
|
||||
app.on = app.addListener = function (event, listener) {
|
||||
if (event === 'platform-theme-changed') {
|
||||
deprecate.warn('platform-theme-changed event', "systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', callback)")
|
||||
electron.systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', function () {
|
||||
app.emit('platform-theme-changed')
|
||||
})
|
||||
}
|
||||
EventEmitter.prototype.addListener.call(app, event, listener)
|
||||
}
|
||||
}
|
||||
|
||||
// Wrappers for native classes.
|
||||
var wrapDownloadItem = function (downloadItem) {
|
||||
// downloadItem is an EventEmitter.
|
||||
Object.setPrototypeOf(downloadItem, EventEmitter.prototype)
|
||||
|
||||
// Deprecated.
|
||||
deprecate.property(downloadItem, 'url', 'getURL')
|
||||
deprecate.property(downloadItem, 'filename', 'getFilename')
|
||||
deprecate.property(downloadItem, 'mimeType', 'getMimeType')
|
||||
return deprecate.rename(downloadItem, 'getUrl', 'getURL')
|
||||
}
|
||||
|
||||
downloadItemBindings._setWrapDownloadItem(wrapDownloadItem)
|
||||
|
|
|
@ -1,7 +1,2 @@
|
|||
const deprecate = require('electron').deprecate
|
||||
const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native')
|
||||
|
||||
// Deprecated.
|
||||
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL')
|
||||
|
||||
module.exports = autoUpdater
|
||||
|
|
|
@ -196,34 +196,6 @@ BrowserWindow.prototype.inspectServiceWorker = function () {
|
|||
return this.webContents.inspectServiceWorker()
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
deprecate.member(BrowserWindow, 'undo', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'redo', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'cut', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'copy', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'paste', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'selectAll', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'reloadIgnoringCache', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'isLoading', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'isWaitingForResponse', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'stop', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'isCrashed', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'print', 'webContents')
|
||||
deprecate.member(BrowserWindow, 'printToPDF', 'webContents')
|
||||
deprecate.rename(BrowserWindow, 'restart', 'reload')
|
||||
deprecate.rename(BrowserWindow, 'loadUrl', 'loadURL')
|
||||
deprecate.rename(BrowserWindow, 'getUrl', 'getURL')
|
||||
|
||||
BrowserWindow.prototype.executeJavaScriptInDevTools = deprecate('executeJavaScriptInDevTools', 'devToolsWebContents.executeJavaScript', function (code) {
|
||||
var ref1
|
||||
return (ref1 = this.devToolsWebContents) != null ? ref1.executeJavaScript(code) : void 0
|
||||
})
|
||||
|
||||
BrowserWindow.prototype.getPageTitle = deprecate('getPageTitle', 'webContents.getTitle', function () {
|
||||
var ref1
|
||||
return (ref1 = this.webContents) != null ? ref1.getTitle() : void 0
|
||||
})
|
||||
|
||||
const isDeprecatedKey = function (key) {
|
||||
return key.indexOf('-') >= 0
|
||||
}
|
||||
|
|
|
@ -1,7 +1,2 @@
|
|||
const deprecate = require('electron').deprecate
|
||||
const ipcMain = require('electron').ipcMain
|
||||
|
||||
// This module is deprecated, we mirror everything from ipcMain.
|
||||
deprecate.warn('ipc module', 'require("electron").ipcMain')
|
||||
|
||||
module.exports = ipcMain
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
const deprecate = require('electron').deprecate
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const Tray = process.atomBinding('tray').Tray
|
||||
|
||||
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
||||
|
||||
Tray.prototype._init = function () {
|
||||
// Deprecated.
|
||||
deprecate.rename(this, 'popContextMenu', 'popUpContextMenu')
|
||||
deprecate.event(this, 'clicked', 'click')
|
||||
deprecate.event(this, 'double-clicked', 'double-click')
|
||||
deprecate.event(this, 'right-clicked', 'right-click')
|
||||
return deprecate.event(this, 'balloon-clicked', 'balloon-click')
|
||||
}
|
||||
|
||||
Tray.prototype.setContextMenu = function (menu) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const deprecate = require('electron').deprecate
|
||||
const ipcMain = require('electron').ipcMain
|
||||
const NavigationController = require('electron').NavigationController
|
||||
const Menu = require('electron').Menu
|
||||
|
@ -160,13 +159,6 @@ let wrapWebContents = function (webContents) {
|
|||
})
|
||||
})
|
||||
|
||||
// Deprecated.
|
||||
deprecate.rename(webContents, 'loadUrl', 'loadURL')
|
||||
deprecate.rename(webContents, 'getUrl', 'getURL')
|
||||
deprecate.event(webContents, 'page-title-set', 'page-title-updated', function (...args) {
|
||||
return this.emit.apply(this, ['page-title-set'].concat(args))
|
||||
})
|
||||
|
||||
webContents.printToPDF = function (options, callback) {
|
||||
var printingSetting
|
||||
printingSetting = {
|
||||
|
|
|
@ -1,7 +1 @@
|
|||
const deprecate = require('electron').deprecate
|
||||
const nativeImage = process.atomBinding('native_image')
|
||||
|
||||
// Deprecated.
|
||||
deprecate.rename(nativeImage, 'createFromDataUrl', 'createFromDataURL')
|
||||
|
||||
module.exports = nativeImage
|
||||
module.exports = process.atomBinding('native_image')
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
'use strict'
|
||||
|
||||
const deprecate = require('electron').deprecate
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
|
||||
const webFrame = process.atomBinding('web_frame').webFrame
|
||||
|
@ -11,9 +10,4 @@ Object.setPrototypeOf(webFrame, EventEmitter.prototype)
|
|||
// Lots of webview would subscribe to webFrame's events.
|
||||
webFrame.setMaxListeners(0)
|
||||
|
||||
// Deprecated.
|
||||
deprecate.rename(webFrame, 'registerUrlSchemeAsSecure', 'registerURLSchemeAsSecure')
|
||||
deprecate.rename(webFrame, 'registerUrlSchemeAsBypassingCSP', 'registerURLSchemeAsBypassingCSP')
|
||||
deprecate.rename(webFrame, 'registerUrlSchemeAsPrivileged', 'registerURLSchemeAsPrivileged')
|
||||
|
||||
module.exports = webFrame
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
'use strict'
|
||||
|
||||
const deprecate = require('electron').deprecate
|
||||
const webFrame = require('electron').webFrame
|
||||
const remote = require('electron').remote
|
||||
const ipcRenderer = require('electron').ipcRenderer
|
||||
|
@ -432,8 +431,6 @@ var registerWebViewElement = function () {
|
|||
return internal.webContents
|
||||
}
|
||||
|
||||
// Deprecated.
|
||||
deprecate.rename(proto, 'getUrl', 'getURL')
|
||||
window.WebView = webFrame.registerEmbedderCustomElement('webview', {
|
||||
prototype: proto
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue