# contextMenus
Documentation: [Chrome Context Menus API](https://developer.chrome.com/docs/extensions/reference/contextMenus)
A promise-based wrapper for the Chrome `contextMenus` API.
## Methods
- [createContextMenus(createProperties?)](#createContextMenus)
- [removeContextMenus(menuItemId)](#removeContextMenus)
- [removeAllContextMenus()](#removeAllContextMenus)
- [updateContextMenus(id, updateProperties?)](#updateContextMenus)
- [createOrUpdateContextMenu(id, properties)](#createOrUpdateContextMenu)
## Events
- [onContextMenusClicked(callback)](#onContextMenusClicked)
---
### createContextMenus
```
createContextMenus(createProperties?: chrome.contextMenus.CreateProperties): Promise
```
Creates a new context menu item with the specified properties.
### removeContextMenus
```
removeContextMenus(menuItemId: string | number): Promise
```
Removes the context menu item with the given ID.
### removeAllContextMenus
```
removeAllContextMenus(): Promise
```
Removes all context menu items added by the extension.
### updateContextMenus
```
updateContextMenus(
id: string | number,
updateProperties?: Omit
): Promise
```
Updates the specified context menu item with new properties.
### createOrUpdateContextMenu
```
createOrUpdateContextMenu(
id: string | number,
properties: Omit
): Promise
```
Tries to create a context menu item. If it already exists (e.g., after service worker wake up), it updates the existing item instead.
### onContextMenusClicked
```
onContextMenusClicked(
callback: (info: chrome.contextMenus.OnClickData, tab?: chrome.tabs.Tab) => void
): () => void
```
Adds a listener that triggers when a context menu item is clicked. Returns an unsubscribe function.