🔧 Allow for menu.popup({})

This commit is contained in:
Felix Rieseberg 2017-12-08 14:37:16 -08:00
parent 9e660b1d32
commit 3719ee0b53

View file

@ -45,6 +45,7 @@ Menu.prototype._init = function () {
Menu.prototype.popup = function (window, x, y, positioningItem) { Menu.prototype.popup = function (window, x, y, positioningItem) {
let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window] let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window]
let opts
// menu.popup(x, y, positioningItem) // menu.popup(x, y, positioningItem)
if (!window) { if (!window) {
@ -54,9 +55,16 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
} }
} }
// menu.popup({})
if (window && typeof window === 'object' && window.constructor &&
window.constructor.name !== 'BrowserWindow') {
opts = window
// menu.popup(window, {}) // menu.popup(window, {})
if (x && typeof x === 'object') { } else if (x && typeof x === 'object') {
const opts = x opts = x
}
if (opts) {
newX = opts.x newX = opts.x
newY = opts.y newY = opts.y
newPosition = opts.positioningItem newPosition = opts.positioningItem