mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
electron: Add null type to get/setApplicationMenu (#15567)
* Add null type to get/setApplicationMenu * Update jsdoc to match new Electron docs
This commit is contained in:
11
types/electron/index.d.ts
vendored
11
types/electron/index.d.ts
vendored
@@ -2605,14 +2605,17 @@ declare namespace Electron {
|
||||
*/
|
||||
constructor();
|
||||
/**
|
||||
* Sets menu as the application menu on macOS. On Windows and Linux, the menu
|
||||
* will be set as each window's top menu.
|
||||
* Sets menu as the application menu on macOS. On Windows and Linux, the
|
||||
* menu will be set as each window's top menu.
|
||||
*
|
||||
* Passing null will remove the menu bar on Windows and Linux but has no
|
||||
* effect on macOS.
|
||||
*/
|
||||
static setApplicationMenu(menu: Menu): void;
|
||||
static setApplicationMenu(menu: Menu | null): void;
|
||||
/**
|
||||
* @returns The application menu if set, or null if not set.
|
||||
*/
|
||||
static getApplicationMenu(): Menu;
|
||||
static getApplicationMenu(): Menu | null;
|
||||
/**
|
||||
* Sends the action to the first responder of application.
|
||||
* This is used for emulating default Cocoa menu behaviors,
|
||||
|
||||
@@ -734,6 +734,7 @@ var template = <Electron.MenuItemOptions[]>[
|
||||
menu = Menu.buildFromTemplate(template);
|
||||
|
||||
Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... });
|
||||
Menu.setApplicationMenu(null);
|
||||
|
||||
Menu.buildFromTemplate([
|
||||
{ label: '4', id: '4' },
|
||||
|
||||
Reference in New Issue
Block a user