foo-webview-sdk
    Preparing search index...

    Class ContextMenuManager

    ContextMenuManager — Context-menu builder for tracks / playlists.

    Backend mapping:

    • BuildMenu(menu, base_id, max_id) → menu.getContextMenu ({ mode, handles })
    • ExecuteByID(id) → menu.runContextCommandById ({ id, mode, handles })

    Three context modes mirror the SMP API:

    • InitContext(handles) → mode = 'handles', attach handle ids.
    • InitContextPlaylist() → mode = 'playlist', no handles.
    • InitNowPlaying() → mode = 'nowPlaying', no handles.

    ExecuteByID also accepts a numeric C++ command id directly; this keeps theme code that bypasses BuildMenu working.

    Index
    • Fetch the menu structure from the host and populate menu.SetItems (when provided). Allocates ids starting at base_id (default 1) and capped to max_id slots.

      Parameters

      • Optionalmenu: MenuTarget
      • Optionalbase_id: number
      • Optionalmax_id: number

      Returns Promise<SmpStructuredMenuItem[]>

      Structured menu tree (sub-menus / separators preserved).

    • Dispatch the previously-allocated menu id (or a raw numeric C++ command id outside the ids the last BuildMenu allocated). Returns false when the command cannot be resolved, including an allocated id whose row carried no commandId.

      Parameters

      • id: string | number

      Returns Promise<boolean>