feat: convert webContents primitives to properties (#18998)
* feat: convert webContents primitives to properties * address feedback from review
This commit is contained in:
parent
de072c6ef5
commit
8782d06ed6
9 changed files with 152 additions and 49 deletions
|
@ -101,7 +101,7 @@ const roles = {
|
|||
accelerator: 'CommandOrControl+0',
|
||||
nonNativeMacOSRole: true,
|
||||
webContentsMethod: (webContents) => {
|
||||
webContents.setZoomLevel(0)
|
||||
webContents.zoomLevel = 0
|
||||
}
|
||||
},
|
||||
selectall: {
|
||||
|
@ -156,8 +156,7 @@ const roles = {
|
|||
accelerator: 'CommandOrControl+Plus',
|
||||
nonNativeMacOSRole: true,
|
||||
webContentsMethod: (webContents) => {
|
||||
const zoomLevel = webContents.getZoomLevel()
|
||||
webContents.setZoomLevel(zoomLevel + 0.5)
|
||||
webContents.zoomLevel += 0.5
|
||||
}
|
||||
},
|
||||
zoomout: {
|
||||
|
@ -165,8 +164,7 @@ const roles = {
|
|||
accelerator: 'CommandOrControl+-',
|
||||
nonNativeMacOSRole: true,
|
||||
webContentsMethod: (webContents) => {
|
||||
const zoomLevel = webContents.getZoomLevel()
|
||||
webContents.setZoomLevel(zoomLevel - 0.5)
|
||||
webContents.zoomLevel -= 0.5
|
||||
}
|
||||
},
|
||||
// App submenu should be used for Mac only
|
||||
|
|
|
@ -416,6 +416,13 @@ WebContents.prototype._init = function () {
|
|||
app.emit('web-contents-created', {}, this)
|
||||
}
|
||||
|
||||
// Deprecations
|
||||
deprecate.fnToProperty(WebContents.prototype, 'audioMuted', '_isAudioMuted', '_setAudioMuted')
|
||||
deprecate.fnToProperty(WebContents.prototype, 'userAgent', '_getUserAgent', '_setUserAgent')
|
||||
deprecate.fnToProperty(WebContents.prototype, 'zoomLevel', '_getZoomLevel', '_setZoomLevel')
|
||||
deprecate.fnToProperty(WebContents.prototype, 'zoomFactor', '_getZoomFactor', '_setZoomFactor')
|
||||
deprecate.fnToProperty(WebContents.prototype, 'frameRate', '_getFrameRate', '_setFrameRate')
|
||||
|
||||
// JavaScript wrapper of Debugger.
|
||||
const { Debugger } = process.electronBinding('debugger')
|
||||
Object.setPrototypeOf(Debugger.prototype, EventEmitter.prototype)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue