🔧 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) {
let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window]
let opts
// menu.popup(x, y, positioningItem)
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, {})
if (x && typeof x === 'object') {
const opts = x
} else if (x && typeof x === 'object') {
opts = x
}
if (opts) {
newX = opts.x
newY = opts.y
newPosition = opts.positioningItem