diff --git a/electron/index.d.ts b/electron/index.d.ts
index 0b98ae1944..11103b3a18 100644
--- a/electron/index.d.ts
+++ b/electron/index.d.ts
@@ -1,6 +1,6 @@
// Type definitions for Electron v1.4.8
// Project: http://electron.atom.io/
-// Definitions by: jedmao , rhysd , Milan Burda , aliib , Daniel Perez Alvarez
+// Definitions by: jedmao , rhysd , Milan Burda , aliib , Daniel Perez Alvarez , Markus Olsson
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///
@@ -2455,7 +2455,11 @@ declare namespace Electron {
*/
constructor(options: MenuItemOptions);
- click: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
+ /**
+ * A function that is fired when the MenuItem receives a click event
+ */
+ click: (event: Event, browserWindow: BrowserWindow, webContents: WebContents) => void;
+
/**
* Read-only property.
*/
@@ -2492,7 +2496,7 @@ declare namespace Electron {
/**
* Callback when the menu item is clicked.
*/
- click?: (menuItem: MenuItem, browserWindow: BrowserWindow) => void;
+ click?: (menuItem: MenuItem, browserWindow: BrowserWindow, event: Event) => void;
/**
* Can be normal, separator, submenu, checkbox or radio.
*/
diff --git a/electron/test/main.ts b/electron/test/main.ts
index 276a15d851..35a85a81dc 100644
--- a/electron/test/main.ts
+++ b/electron/test/main.ts
@@ -531,12 +531,19 @@ var winWindows = new BrowserWindow({
// menu-item
// https://github.com/atom/electron/blob/master/docs/api/menu-item.md
-var menuItem = new MenuItem({});
+var menuItem = new MenuItem({
+ click: (menuItem: Electron.MenuItem, browserWindow: Electron.BrowserWindow, event: Electron.Event) => {
+ console.log('click', menuItem, browserWindow, event);
+ }
+});
+
+const fakeEvent: Electron.Event = {
+ preventDefault: () => { },
+ sender: winWindows.webContents,
+}
menuItem.label = 'Hello World!';
-menuItem.click = (menuItem, browserWindow) => {
- console.log('click', menuItem, browserWindow);
-};
+menuItem.click(fakeEvent, winWindows, winWindows.webContents)
// menu
// https://github.com/atom/electron/blob/master/docs/api/menu.md