目录

MenuWithRole

Extends: MenuElement

A menu with predefined role that may contain a list of menu items.

import { MenuWithRole } from '@mobrowser/api';

Example 

import { app, Menu, MenuWithRole, MenuItem } from '@mobrowser/api';

const fileMenu = new MenuWithRole({
  role: 'fileMenu',
  items: [
    new MenuItem({
      id: 'new',
      label: 'New',
      action: (item: MenuItem) => { }
    })
  ]
})
app.setMenu(new Menu({ label: 'App', items: [fileMenu] }))

Properties 

role 

readonly role: MenuRole;

The role of the menu.

items 

readonly items: (MenuElement | MenuItemRole)[];

The items of the menu.

Methods 

constructor() 

constructor(options: MenuWithRoleOptions): void;

Creates a new menu with a role.

ParameterTypeDescription
optionsMenuWithRoleOptionsThe options for constructing the menu with a role.