remove excess code in delegate

This commit is contained in:
Shelley Vohr 2017-10-23 22:33:23 -04:00
parent 9b364d5be3
commit 508b614769
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -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: () => {