🎨
This commit is contained in:
parent
96ef09742c
commit
68d937ed47
1 changed files with 3 additions and 6 deletions
|
@ -24,13 +24,10 @@ class MenuItem
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
{Menu} = require 'electron'
|
{Menu} = require 'electron'
|
||||||
|
|
||||||
{click, @selector, @type, @role, @label, @sublabel, @accelerator, @icon, @enabled, @visible, @checked} = options
|
{click, @selector, @type, @role, @label, @sublabel, @accelerator, @icon, @enabled, @visible, @checked, @submenu} = options
|
||||||
|
|
||||||
if options.submenu?
|
if @submenu? and @submenu.constructor isnt Menu
|
||||||
if options.submenu.constructor is Menu
|
@submenu = Menu.buildFromTemplate @submenu
|
||||||
@submenu = options.submenu
|
|
||||||
else
|
|
||||||
@submenu = Menu.buildFromTemplate options.submenu
|
|
||||||
@type = 'submenu' if not @type? and @submenu?
|
@type = 'submenu' if not @type? and @submenu?
|
||||||
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
|
throw new Error('Invalid submenu') if @type is 'submenu' and @submenu?.constructor isnt Menu
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue