Remove deprecated APIs

This commit is contained in:
Kevin Sawicki 2016-04-28 09:38:05 -07:00
parent 0cf50b1c0b
commit dae68be2ce
9 changed files with 2 additions and 121 deletions

View file

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