Movatterモバイル変換


[0]ホーム

URL:


  1. Mozilla
  2. Add-ons
  3. Browser extensions
  4. JavaScript APIs
  5. commands
  6. getAll()

getAll()

Gets all commands for the extension that you have registered using thecommands manifest.json key.

The commands are returned as an array ofcommands.Command objects. Alternately, if you are using the promise-based version of the API,browser.commands.getAll(), the commands are passed into theonFulfilled argument toPromise.then().

Syntax

js
let getCommands = browser.commands.getAll();

Parameters

None.

Return value

APromise that will be fulfilled with an array ofcommands.Command objects, one for each command registered for the extension. If no commands were registered, the array will be empty.

Examples

js
function logCommands(commands) {  commands.forEach((command) => {    console.log(command);  });}let getCommands = browser.commands.getAll();getCommands.then(logCommands);

Example extensions

Browser compatibility

Note:This API is based on Chromium'schrome.commands API.

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp