From 3505e98a46c9edf06c7b110b743a6dbe2da0a054 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 21 Jun 2016 10:06:56 -0700 Subject: [PATCH] Access function in methodInBrowserWindow --- lib/browser/api/menu-item.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/browser/api/menu-item.js b/lib/browser/api/menu-item.js index de5aab28ef10..651de147af1b 100644 --- a/lib/browser/api/menu-item.js +++ b/lib/browser/api/menu-item.js @@ -82,12 +82,10 @@ const MenuItem = (function () { const methodName = rolesMap[this.role] if (methodInApp[methodName]) { return app[methodName]() + } else if (typeof methodInBrowserWindow[methodName] === 'function') { + return methodInBrowserWindow[methodName](focusedWindow) } else if (methodInBrowserWindow[methodName]) { - if (typeof methodName === 'function') { - return methodName(focusedWindow) - } else { - return focusedWindow[methodName]() - } + return focusedWindow[methodName]() } else { const {webContents} = focusedWindow return webContents != null ? webContents[methodName]() : void 0