# commands Documentation: [Chrome Commands API](https://developer.chrome.com/docs/extensions/reference/commands) A promise-based wrapper for the Chrome `commands` API. ## Methods - [getAllCommands()](#getAllCommands) ## Events - [onCommand(callback)](#onCommand) - [onSpecificCommand(command, callback)](#onSpecificCommand) --- ### getAllCommands ``` getAllCommands(): Promise ``` Retrieves all registered extension commands. ### onCommand ``` onCommand(callback: (command: string, tab: chrome.tabs.Tab) => void): () => void ``` Adds a listener for extension command events. Returns an unsubscribe function. ### onSpecificCommand ``` onSpecificCommand( command: string, callback: (tab?: chrome.tabs.Tab) => any ): () => void ``` Adds a listener that triggers only when the specified command is invoked. Returns an unsubscribe function.