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:
Philip Jackson
2017-04-18 03:28:18 +12:00
committed by Andy
parent 1757c1257a
commit 05c50b9719
2 changed files with 8 additions and 4 deletions

View File

@@ -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,

View File

@@ -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' },