💄 Use spread operator instead of arguments object
This commit is contained in:
parent
236810a923
commit
fd9c9c3be7
1 changed files with 17 additions and 16 deletions
|
@ -50,13 +50,13 @@ BrowserWindow.prototype._init = function () {
|
|||
if (!event.defaultPrevented) this.setTitle(title)
|
||||
})
|
||||
|
||||
// Sometimes the webContents doesn't get focus when window is shown, so we
|
||||
// have to force focusing on webContents in this case. The safest way is to
|
||||
// focus it when we first start to load URL, if we do it earlier it won't
|
||||
// Sometimes the webContents doesn't get focus when window is shown, so we
|
||||
// have to force focusing on webContents in this case. The safest way is to
|
||||
// focus it when we first start to load URL, if we do it earlier it won't
|
||||
// have effect, if we do it later we might move focus in the page.
|
||||
//
|
||||
// Though this hack is only needed on OS X when the app is launched from
|
||||
// Finder, we still do it on all platforms in case of other bugs we don't
|
||||
// Finder, we still do it on all platforms in case of other bugs we don't
|
||||
// know.
|
||||
this.webContents.once('load-url', function () {
|
||||
this.focus()
|
||||
|
@ -79,7 +79,7 @@ BrowserWindow.prototype._init = function () {
|
|||
this.webContents.send('ELECTRON_RENDERER_WINDOW_VISIBILITY_CHANGE', isVisible ? 'visible' : 'hidden')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const visibilityEvents = ['show', 'hide', 'minimize', 'maximize', 'restore']
|
||||
for (let event of visibilityEvents) {
|
||||
this.on(event, visibilityChanged)
|
||||
|
@ -101,6 +101,7 @@ BrowserWindow.getFocusedWindow = () => {
|
|||
for (let window of BrowserWindow.getAllWindows()) {
|
||||
if (window.isFocused()) return window
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
BrowserWindow.fromWebContents = (webContents) => {
|
||||
|
@ -118,20 +119,20 @@ BrowserWindow.fromDevToolsWebContents = (webContents) => {
|
|||
// Helpers.
|
||||
|
||||
Object.assign(BrowserWindow.prototype, {
|
||||
loadURL () {
|
||||
return this.webContents.loadURL.apply(this.webContents, arguments)
|
||||
loadURL (...args) {
|
||||
return this.webContents.loadURL.apply(this.webContents, args)
|
||||
},
|
||||
getURL () {
|
||||
getURL (...args) {
|
||||
return this.webContents.getURL()
|
||||
},
|
||||
reload () {
|
||||
return this.webContents.reload.apply(this.webContents, arguments)
|
||||
reload (...args) {
|
||||
return this.webContents.reload.apply(this.webContents, args)
|
||||
},
|
||||
send () {
|
||||
return this.webContents.send.apply(this.webContents, arguments)
|
||||
send (...args) {
|
||||
return this.webContents.send.apply(this.webContents, args)
|
||||
},
|
||||
openDevTools () {
|
||||
return this.webContents.openDevTools.apply(this.webContents, arguments)
|
||||
openDevTools (...args) {
|
||||
return this.webContents.openDevTools.apply(this.webContents, args)
|
||||
},
|
||||
closeDevTools () {
|
||||
return this.webContents.closeDevTools()
|
||||
|
@ -145,8 +146,8 @@ Object.assign(BrowserWindow.prototype, {
|
|||
toggleDevTools () {
|
||||
return this.webContents.toggleDevTools()
|
||||
},
|
||||
inspectElement () {
|
||||
return this.webContents.inspectElement.apply(this.webContents, arguments)
|
||||
inspectElement (...args) {
|
||||
return this.webContents.inspectElement.apply(this.webContents, args)
|
||||
},
|
||||
inspectServiceWorker () {
|
||||
return this.webContents.inspectServiceWorker()
|
||||
|
|
Loading…
Reference in a new issue