Access function in methodInBrowserWindow

This commit is contained in:
Kevin Sawicki 2016-06-21 10:06:56 -07:00
parent 35097b244e
commit 3505e98a46

View file

@ -82,12 +82,10 @@ const MenuItem = (function () {
const methodName = rolesMap[this.role] const methodName = rolesMap[this.role]
if (methodInApp[methodName]) { if (methodInApp[methodName]) {
return app[methodName]() return app[methodName]()
} else if (typeof methodInBrowserWindow[methodName] === 'function') {
return methodInBrowserWindow[methodName](focusedWindow)
} else if (methodInBrowserWindow[methodName]) { } else if (methodInBrowserWindow[methodName]) {
if (typeof methodName === 'function') { return focusedWindow[methodName]()
return methodName(focusedWindow)
} else {
return focusedWindow[methodName]()
}
} else { } else {
const {webContents} = focusedWindow const {webContents} = focusedWindow
return webContents != null ? webContents[methodName]() : void 0 return webContents != null ? webContents[methodName]() : void 0