refactor: simplify events (#37099)

This commit is contained in:
Jeremy Rose 2023-02-13 13:39:18 -08:00 committed by GitHub
parent 8b3e498436
commit 71944f2c3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 290 additions and 409 deletions

View file

@ -1,5 +1,5 @@
import * as roles from '@electron/internal/browser/api/menu-item-roles';
import { Menu, Event, BrowserWindow, WebContents } from 'electron/main';
import { Menu, BrowserWindow, WebContents, KeyboardEvent } from 'electron/main';
let nextCommandId = 0;
@ -53,7 +53,7 @@ const MenuItem = function (this: any, options: any) {
});
const click = options.click;
this.click = (event: Event, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {
this.click = (event: KeyboardEvent, focusedWindow: BrowserWindow, focusedWebContents: WebContents) => {
// Manually flip the checked flags when clicked.
if (!roles.shouldOverrideCheckStatus(this.role) &&
(this.type === 'checkbox' || this.type === 'radio')) {