Deprecate the platform-theme-changed event

This commit is contained in:
Cheng Zhao 2016-04-25 14:34:30 +09:00
parent 9557226223
commit a421c66f3f
7 changed files with 11 additions and 28 deletions

View file

@ -91,12 +91,21 @@ deprecate.event(app, 'activate-with-no-open-windows', 'activate', function (even
deprecate.event(app, 'select-certificate', 'select-client-certificate')
if (process.platform === 'win32') {
app.isAeroGlassEnabled = deprecate('app.isAeroGlassEnabled', 'systemPreferences.isAeroGlassEnabled', function () {
return electron.systemPreferences.isAeroGlassEnabled();
return electron.systemPreferences.isAeroGlassEnabled()
})
} else if (process.platform === 'darwin') {
app.isDarkMode = deprecate('app.isDarkMode', 'systemPreferences.isDarkMode', function () {
return electron.systemPreferences.isDarkMode();
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.