remove excess code in delegate
This commit is contained in:
parent
9b364d5be3
commit
508b614769
1 changed files with 11 additions and 23 deletions
|
@ -16,31 +16,19 @@ Menu.prototype._init = function () {
|
|||
this.groupsMap = {}
|
||||
this.items = []
|
||||
this.delegate = {
|
||||
isCommandIdChecked: (commandId) => {
|
||||
var command = this.commandsMap[commandId]
|
||||
return command != null ? command.checked : undefined
|
||||
},
|
||||
isCommandIdEnabled: (commandId) => {
|
||||
var command = this.commandsMap[commandId]
|
||||
return command != null ? command.enabled : undefined
|
||||
},
|
||||
isCommandIdVisible: (commandId) => {
|
||||
var command = this.commandsMap[commandId]
|
||||
return command != null ? command.visible : undefined
|
||||
},
|
||||
getAcceleratorForCommandId: (commandId, useDefaultAccelerator) => {
|
||||
const command = this.commandsMap[commandId]
|
||||
if (command == null) return
|
||||
if (command.accelerator != null) return command.accelerator
|
||||
isCommandIdChecked: id => this.commandsMap[id].checked,
|
||||
isCommandIdEnabled: id => this.commandsMap[id].enabled,
|
||||
isCommandIdVisible: id => this.commandsMap[id].visible,
|
||||
getAcceleratorForCommandId: (id, useDefaultAccelerator) => {
|
||||
const command = this.commandsMap[id]
|
||||
if (command === null) return
|
||||
if (command.accelerator !== null) return command.accelerator
|
||||
if (useDefaultAccelerator) return command.getDefaultRoleAccelerator()
|
||||
},
|
||||
getIconForCommandId: (commandId) => {
|
||||
var command = this.commandsMap[commandId]
|
||||
return command != null ? command.icon : undefined
|
||||
},
|
||||
executeCommand: (event, commandId) => {
|
||||
const command = this.commandsMap[commandId]
|
||||
if (command == null) return
|
||||
getIconForCommandId: id => this.commandsMap[id].icon,
|
||||
executeCommand: (event, id) => {
|
||||
const command = this.commandsMap[id]
|
||||
if (command === null) return
|
||||
command.click(event, BrowserWindow.getFocusedWindow(), webContents.getFocusedWebContents())
|
||||
},
|
||||
menuWillShow: () => {
|
||||
|
|
Loading…
Reference in a new issue