Cocos Creator
Editor.Menu
Methods
Editor.Menu.popup (template[, x, y])
template
array|object - Menu template for initialize. The template take the options of Electron's Menu Itemx
number - The position xy
number - The position y
Send menu:popup
to main process.
Editor.Menu.register (name, tmpl[, force])
name
string - The name of the register menutmpl
object - Menu templateforce
boolean - Force to register a menu even it was registered before.
Send menu:register
to main process.
Editor.Menu.walk (template, fn)
template
array|object - Menu template.fn
functoin - Function applied to each menu item
Example:
js
Editor.Menu.walk(menuTmpl, item => {
if ( item.params ) {
item.params.unshift('Hello');
}
if (item.message === 'foobar:say-hello') {
item.enabled = false;
}
});