Represents an object with methods to show a context menu.

interface ContextMenu {
    show(x: number, y: number, items: ContextMenuItem[]): Promise<ContextMenuItem>;
}

Methods

Methods

  • Shows a context menu with the specified items. The context menu closes when the user clicks one of the items or outside the context menu.

    Parameters

    • x: number

      The horizontal pixel coordinate where to show the context menu.

    • y: number

      The vertical pixel coordinate where to show the context menu.

    • items: ContextMenuItem[]

      Defines the content of the context menu.

    Returns Promise<ContextMenuItem>

    A Promise that, when resolved, provides the ContextMenuItem that was clicked by the user, or undefined if the user clicked outside the context menu.