forgot to remove old method
This commit is contained in:
parent
73ab87b87f
commit
56f06187d5
1 changed files with 0 additions and 59 deletions
|
@ -43,65 +43,6 @@ Menu.prototype._init = function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu.prototype.popupOld = function (window, x, y, positioningItem) {
|
|
||||||
let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window]
|
|
||||||
let opts
|
|
||||||
let callback
|
|
||||||
|
|
||||||
// menu.popup(x, y, positioningItem)
|
|
||||||
if (window != null && !(window instanceof BrowserWindow)) {
|
|
||||||
[newPosition, newY, newX, newWindow] = [y, x, window, null]
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu.popup([w], x, y, callback)
|
|
||||||
if (typeof newPosition === 'function') {
|
|
||||||
callback = newPosition
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu.popup({}) || menu.popup(window, callback)
|
|
||||||
if ((window != null && window.constructor === Object) ||
|
|
||||||
(x && typeof x === 'function')) {
|
|
||||||
opts = window
|
|
||||||
callback = arguments[1]
|
|
||||||
// menu.popup(window, {})
|
|
||||||
} else if (x && typeof x === 'object') {
|
|
||||||
opts = x
|
|
||||||
callback = arguments[2]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts) {
|
|
||||||
newX = opts.x
|
|
||||||
newY = opts.y
|
|
||||||
newPosition = opts.positioningItem
|
|
||||||
}
|
|
||||||
if (typeof callback !== 'function') {
|
|
||||||
callback = () => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set defaults
|
|
||||||
if (typeof newX !== 'number') newX = -1
|
|
||||||
if (typeof newY !== 'number') newY = -1
|
|
||||||
if (typeof newPosition !== 'number') newPosition = -1
|
|
||||||
if (!newWindow || (newWindow && newWindow.constructor !== BrowserWindow)) {
|
|
||||||
newWindow = BrowserWindow.getFocusedWindow()
|
|
||||||
|
|
||||||
// No window focused?
|
|
||||||
if (!newWindow) {
|
|
||||||
const browserWindows = BrowserWindow.getAllWindows()
|
|
||||||
|
|
||||||
if (browserWindows && browserWindows.length > 0) {
|
|
||||||
newWindow = browserWindows[0]
|
|
||||||
} else {
|
|
||||||
throw new Error(`Cannot open Menu without a BrowserWindow present`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.popupAt(newWindow, newX, newY, newPosition, callback)
|
|
||||||
|
|
||||||
return { browserWindow: newWindow, x: newX, y: newY, position: newPosition }
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu.prototype.popup = function (window, options, callback) {
|
Menu.prototype.popup = function (window, options, callback) {
|
||||||
let x, y, pos
|
let x, y, pos
|
||||||
let [win, opts, cb] = [window, options, callback]
|
let [win, opts, cb] = [window, options, callback]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue