Contents

ContextMenuItem

Extends: ContextMenuItemBase

A context menu item that can be clicked to perform an action.

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

Example 

import { ContextMenu, ContextMenuItem } from '@mobrowser/api';

const menu = new ContextMenu({
  items: [
    new ContextMenuItem({
      label: 'Copy',
      action: (item: ContextMenuItem) => { console.log('Copied') }
    })
  ]
})

Properties 

label 

readonly label?: string;

The label of the context menu item.

enabled 

readonly enabled?: boolean;

Whether the context menu item is enabled.

action 

readonly action?: (item: ContextMenuItem) => void;

The action to perform when the context menu item is clicked.

Methods 

constructor() 

constructor(options: ContextMenuItemBaseOptions<ContextMenuItem>): void;

Creates a new context menu item.

ParameterTypeDescription
optionsContextMenuItemBaseOptions<ContextMenuItem>The options for constructing the context menu item.