Go back to top

vivaldi.menuContent Modders API Reference

Use the vivaldi.menuContent API to configure menus.

Types

#NodeType

ENUM

Defines supported nodes

  • menu
  • command
  • checkbox
  • radio
  • folder
  • separator
  • container
  • #Role

    ENUM

    Defines menu type.

  • horizontal
  • vertical
  • mac
  • context
  • #ContainerMode

    ENUM

    Defines container layouts.

  • inline
  • folder
  • #ContainerEdge

    ENUM

    Defines on what edge of a container additional items can be added.

  • above
  • below
  • off
  • A node (folder or menu entry) in the menu tree. Child nodes are ordered within their parent folder.

    Properties:

    id
    string

    Unique identifier.

    type
    NodeType

    The kind of node.

    action
    string

    A command or a menu identifier. It does not have to be unique. Can be empty for separators.

    custom
    (optional)
    boolean

    When true, the item has been added by the user.

    title
    (optional)
    string

    Node title. If not present the title is determined using the action.

    showshortcut
    (optional)
    boolean

    Show shortcut string.

    radiogroup
    (optional)
    string

    Mandatory for radio elements.

    containermode
    (optional)
    ContainerMode

    Mandatory for container elements.

    containeredge
    (optional)
    ContainerEdge

    Mandatory for container elements.

    parameter
    (optional)
    string

    Free form parameter. Format varies with action.

    children
    (optional)

    An ordered list of children of this node.

    Array of:

    • MenuTreeNode

    Listeners

    How to use listeners

    Each listener type has the same functions, used for each listener API in the same way:

    .addListener(function callback)

    Adds a function to a listener for an event

    .removeListener(function callback)

    Removes a function to a listener for an event

    .hasListener(function callback)

    Returns a boolean if a function is attached to a listener for an event

    .hasListeners()

    Returns a boolean if a listener has any attached functions

    .dispatch()

    Returns array of promises dispatched to the listener

    #onChanged

    Fires when the content of a menu has changed.

    Parameters:

    menu
    string

    Menu resource name.

    id
    string

    Unique identifier for menu.

    role
    Role

    Describes the role of menu.

    selectId
    string

    If non-negative this id can be used to set selected element.

    items

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • MenuTreeNode

    Methods

    #get

    Retrieves content of a menu.

    Parameters:

    menu
    string

    Menu resource name.

    callback

    ⚠ NO DESCRIPTION PROVIDED

    Parameters:

    id
    string

    Root id of the menu.

    role
    Role

    Describes how the menu can be used.

    result

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • MenuTreeNode

    #move

    Moves one or more items within a menu.

    Parameters:

    menu
    string

    Menu resource name.

    ids

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • string
    parentId
    string

    ⚠ NO DESCRIPTION PROVIDED

    index
    integer

    ⚠ NO DESCRIPTION PROVIDED

    #create

    Add one or more items within a menu.

    Parameters:

    menu
    string

    Menu resource name.

    parentId
    string

    ⚠ NO DESCRIPTION PROVIDED

    index
    integer

    Where to add elements. A negative value means at end.

    items

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • MenuTreeNode
    callback

    ⚠ NO DESCRIPTION PROVIDED

    Parameters:

    result
    boolean

    ⚠ NO DESCRIPTION PROVIDED

    ids

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • string

    #remove

    Deletes one or more items within a menu.

    Parameters:

    menu
    string

    Menu resource name.

    ids

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • string

    #removeAction

    Deletes one or more actions from all models

    Parameters:

    actions

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • string

    #update

    Updates the properties of a node.

    Parameters:

    menu
    string

    Menu resource name.

    id
    string

    ⚠ NO DESCRIPTION PROVIDED

    changes
    object

    ⚠ NO DESCRIPTION PROVIDED

    Object Properties:

    title
    (optional)
    string

    ⚠ NO DESCRIPTION PROVIDED

    parameter
    (optional)
    string

    ⚠ NO DESCRIPTION PROVIDED

    showshortcut
    (optional)
    boolean

    ⚠ NO DESCRIPTION PROVIDED

    containerMode
    (optional)
    ContainerMode

    ⚠ NO DESCRIPTION PROVIDED

    containerEdge
    (optional)
    ContainerEdge

    ⚠ NO DESCRIPTION PROVIDED

    #reset

    Restores default content within a menu or in a submenu of that menu.

    Parameters:

    menu
    string

    Menu resource name.

    isContext
    boolean

    ⚠ NO DESCRIPTION PROVIDED

    ids
    (optional)

    ⚠ NO DESCRIPTION PROVIDED

    Array of:

    • string