зеркало из https://github.com/electron/electron.git
Add quit role
This commit is contained in:
Родитель
f45e6c6c38
Коммит
a16d907684
|
@ -15,7 +15,8 @@ rolesMap = {
|
|||
selectall: 'selectAll',
|
||||
minimize: 'minimize',
|
||||
close: 'close',
|
||||
delete: 'delete'
|
||||
delete: 'delete',
|
||||
quit: 'quit'
|
||||
}
|
||||
|
||||
// Maps methods that should be called directly on the BrowserWindow instance
|
||||
|
@ -24,12 +25,16 @@ methodInBrowserWindow = {
|
|||
close: true
|
||||
}
|
||||
|
||||
const methodInApp = {
|
||||
quit: true
|
||||
}
|
||||
|
||||
MenuItem = (function () {
|
||||
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio']
|
||||
|
||||
function MenuItem (options) {
|
||||
var click, ref
|
||||
const Menu = require('electron').Menu
|
||||
const {app, Menu} = require('electron')
|
||||
click = options.click
|
||||
this.selector = options.selector
|
||||
this.type = options.type
|
||||
|
@ -73,7 +78,9 @@ MenuItem = (function () {
|
|||
}
|
||||
if (this.role && rolesMap[this.role] && process.platform !== 'darwin' && (focusedWindow != null)) {
|
||||
methodName = rolesMap[this.role]
|
||||
if (methodInBrowserWindow[methodName]) {
|
||||
if(methodInApp[methodName]) {
|
||||
return app[methodName]()
|
||||
} else if (methodInBrowserWindow[methodName]) {
|
||||
return focusedWindow[methodName]()
|
||||
} else {
|
||||
return (ref2 = focusedWindow.webContents) != null ? ref2[methodName]() : void 0
|
||||
|
|
Загрузка…
Ссылка в новой задаче