Default to focused window whenever param is null/undefined

This commit is contained in:
Kevin Sawicki 2017-02-22 12:53:29 -08:00
parent 3e05350d6b
commit c951e253c6

View file

@ -152,7 +152,7 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
positioningItem = y positioningItem = y
y = x y = x
x = window x = window
window = BrowserWindow.getFocusedWindow() window = null
} }
// menu.popup(window, {}) // menu.popup(window, {})
@ -164,6 +164,9 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
asyncPopup = options.async asyncPopup = options.async
} }
// Default to showing in focused window.
if (window == null) window = BrowserWindow.getFocusedWindow()
// Default to showing under mouse location. // Default to showing under mouse location.
if (typeof x !== 'number') x = -1 if (typeof x !== 'number') x = -1
if (typeof y !== 'number') y = -1 if (typeof y !== 'number') y = -1