Add "event" parameter for "click" handler of MenuItem

This commit is contained in:
Cheng Zhao 2016-06-22 11:22:14 +09:00
parent e6327fb015
commit 8d08e215b2
5 changed files with 11 additions and 9 deletions

View file

@ -72,7 +72,7 @@ const MenuItem = (function () {
throw new Error('Unknown menu type ' + this.type)
}
this.commandId = ++nextCommandId
this.click = (focusedWindow) => {
this.click = (event, focusedWindow) => {
// Manually flip the checked flags when clicked.
if (this.type === 'checkbox' || this.type === 'radio') {
this.checked = !this.checked
@ -91,7 +91,7 @@ const MenuItem = (function () {
return webContents != null ? webContents[methodName]() : void 0
}
} else if (typeof click === 'function') {
return click(this, focusedWindow)
return click(this, focusedWindow, event)
} else if (typeof this.selector === 'string' && process.platform === 'darwin') {
return Menu.sendActionToFirstResponder(this.selector)
}