Add togglefullscreen role
This commit is contained in:
parent
59ff3dc2f3
commit
e3e1ed41ca
1 changed files with 11 additions and 3 deletions
|
@ -14,13 +14,17 @@ const rolesMap = {
|
||||||
minimize: 'minimize',
|
minimize: 'minimize',
|
||||||
close: 'close',
|
close: 'close',
|
||||||
delete: 'delete',
|
delete: 'delete',
|
||||||
quit: 'quit'
|
quit: 'quit',
|
||||||
|
togglefullscreen: 'toggleFullScreen'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maps methods that should be called directly on the BrowserWindow instance
|
// Maps methods that should be called directly on the BrowserWindow instance
|
||||||
const methodInBrowserWindow = {
|
const methodInBrowserWindow = {
|
||||||
minimize: true,
|
minimize: true,
|
||||||
close: true
|
close: true,
|
||||||
|
toggleFullScreen: function (window) {
|
||||||
|
window.setFullScreen(!window.isFullScreen())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const methodInApp = {
|
const methodInApp = {
|
||||||
|
@ -79,7 +83,11 @@ const MenuItem = (function () {
|
||||||
if (methodInApp[methodName]) {
|
if (methodInApp[methodName]) {
|
||||||
return app[methodName]()
|
return app[methodName]()
|
||||||
} else if (methodInBrowserWindow[methodName]) {
|
} else if (methodInBrowserWindow[methodName]) {
|
||||||
return focusedWindow[methodName]()
|
if (typeof methodName === 'function') {
|
||||||
|
return methodName(focusedWindow)
|
||||||
|
} else {
|
||||||
|
return focusedWindow[methodName]()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const {webContents} = focusedWindow
|
const {webContents} = focusedWindow
|
||||||
return webContents != null ? webContents[methodName]() : void 0
|
return webContents != null ? webContents[methodName]() : void 0
|
||||||
|
|
Loading…
Reference in a new issue