commands

监听用户执行你已使用 commands manifest.json 键注册的命令。

类型

commands.Command

表示命令的对象。此对象包含在 commands manifest.json 键中为命令指定的信息。

函数

commands.getAll

获取此扩展程序的所有已注册命令。

commands.reset

重置给定命令的描述和快捷键为清单(manifest)键中给定的值。

commands.update

更改给定命令的描述或快捷键。

事件

commands.onChanged

当命令的快捷键发生更改时触发。

commands.onCommand

当使用关联的快捷键执行命令时触发。

示例扩展

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
commands
Command
Command.description
Command.name
Command.shortcut
getAll
onChanged
onCommand
onCommand.name
onCommand.tab
reset
update
update.description
update.name
update.shortcut

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

备注: 此 API 基于 Chromium 的 chrome.commands API。