Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/commands/index.md
6557 views
------{{AddonSidebar}}
Listen for the user executing commands that you have registered using the commands manifest.json key.
Types
{{WebExtAPIRef("commands.Command")}}
: Object representing a command. This contains the information specified for the command in the
commandsmanifest.json key.
Functions
{{WebExtAPIRef("commands.getAll")}}
: Gets all registered commands for this extension.
{{WebExtAPIRef("commands.reset")}}
: Reset the given command's description and shortcut to the values given in the manifest key.
{{WebExtAPIRef("commands.update")}}
: Change the description or shortcut for the given command.
Events
{{WebExtAPIRef("commands.onCommand")}}
: Fired when a command is executed using its associated keyboard shortcut.
{{WebExtExamples("h2")}}
Browser compatibility
{{Compat}}
Note:
This API is based on Chromium's
chrome.commandsAPI.