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().
In this article
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.