update a few menu.popup() calls to use the new API
This commit is contained in:
parent
35e90f742b
commit
708f39a1a5
3 changed files with 9 additions and 4 deletions
|
@ -293,7 +293,12 @@ WebContents.prototype._init = function () {
|
||||||
this.on('pepper-context-menu', function (event, params, callback) {
|
this.on('pepper-context-menu', function (event, params, callback) {
|
||||||
// Access Menu via electron.Menu to prevent circular require.
|
// Access Menu via electron.Menu to prevent circular require.
|
||||||
const menu = electron.Menu.buildFromTemplate(params.menu)
|
const menu = electron.Menu.buildFromTemplate(params.menu)
|
||||||
menu.popup(event.sender.getOwnerBrowserWindow(), params.x, params.y, callback)
|
menu.popup({
|
||||||
|
window: event.sender.getOwnerBrowserWindow(),
|
||||||
|
x: params.x,
|
||||||
|
y: params.y,
|
||||||
|
callback: callback
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// The devtools requests the webContents to reload.
|
// The devtools requests the webContents to reload.
|
||||||
|
|
|
@ -63,7 +63,7 @@ const createMenu = function (x, y, items) {
|
||||||
|
|
||||||
// The menu is expected to show asynchronously.
|
// The menu is expected to show asynchronously.
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
menu.popup(remote.getCurrentWindow())
|
menu.popup({window: remote.getCurrentWindow()})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,12 +334,12 @@ describe('Menu module', () => {
|
||||||
|
|
||||||
it('should emit menu-will-show event', (done) => {
|
it('should emit menu-will-show event', (done) => {
|
||||||
menu.on('menu-will-show', () => { done() })
|
menu.on('menu-will-show', () => { done() })
|
||||||
menu.popup(w)
|
menu.popup({window: w})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should emit menu-will-close event', (done) => {
|
it('should emit menu-will-close event', (done) => {
|
||||||
menu.on('menu-will-close', () => { done() })
|
menu.on('menu-will-close', () => { done() })
|
||||||
menu.popup(w)
|
menu.popup({window: w})
|
||||||
menu.closePopup()
|
menu.closePopup()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue