Allow settting menu to null
This commit is contained in:
parent
cc3066e746
commit
6d6e75795f
2 changed files with 3 additions and 2 deletions
|
@ -73,7 +73,7 @@ BrowserWindow::setMenu = (menu) ->
|
|||
if process.platform is 'darwin'
|
||||
throw new Error('BrowserWindow.setMenu is not available on OS X')
|
||||
|
||||
throw new TypeError('Invalid menu') unless menu?.constructor?.name is 'Menu'
|
||||
throw new TypeError('Invalid menu') unless menu is null or menu?.constructor?.name is 'Menu'
|
||||
|
||||
@menu = menu # Keep a reference of menu in case of GC.
|
||||
@menu.attachToWindow this
|
||||
|
|
|
@ -130,11 +130,12 @@ Menu::_callMenuWillShow = ->
|
|||
|
||||
applicationMenu = null
|
||||
Menu.setApplicationMenu = (menu) ->
|
||||
throw new TypeError('Invalid menu') unless menu?.constructor is Menu
|
||||
throw new TypeError('Invalid menu') unless menu is null or menu.constructor is Menu
|
||||
applicationMenu = menu # Keep a reference.
|
||||
|
||||
if process.platform is 'darwin'
|
||||
menu._callMenuWillShow()
|
||||
throw new Error('You can not remove application menu') if menu is null
|
||||
bindings.setApplicationMenu menu
|
||||
else
|
||||
windows = BrowserWindow.getAllWindows()
|
||||
|
|
Loading…
Reference in a new issue