Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/mozilla/add-ons/webextensions/api/commands/index.md
6557 views
---
title: commands slug: Mozilla/Add-ons/WebExtensions/API/commands page-type: webextension-api tags: - API - Add-ons - Extensions - Non-standard - Reference - WebExtensions - commands browser-compat: webextensions.api.commands
---

{{AddonSidebar}}

Listen for the user executing commands that you have registered using the commands manifest.json key.

Types

  • {{WebExtAPIRef("commands.Command")}}

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.commands API.