ContextMenu
Extends: ContextMenuElement
A context menu that contains a list of context menu items.
import { ContextMenu } from '@mobrowser/api';
Example
import { app, ContextMenu, ContextMenuItem } from '@mobrowser/api';
const win = app.createWindow()
win.browser.handle('showContextMenu', () => {
return new ContextMenu({
items: [
new ContextMenuItem({ label: 'Copy', action: (item: ContextMenuItem) => { } }),
'copy'
]
})
})
win.show()
Properties
label
readonly label?: string;
The label of the menu.
items
readonly items: (ContextMenuElement | ContextMenuItemRole)[];
The items of the menu.
Methods
constructor()
constructor(options: ContextMenuOptions): void;
Creates a new context menu.
| Parameter | Type | Description |
|---|---|---|
options | ContextMenuOptions | The options for constructing the context menu. |