使用Debian下的Firefox 56在webextension中创建一个快捷方式

时间:2017-10-09 17:33:58

标签: javascript firefox-webextensions

我尝试在我的webextension中有一个像Ctrl + Shift + 0这样的快捷方式,但它不起作用!

manifest.json:

    {
  "name": "Sample Commands Extension",
  "description": "Press Ctrl+Shift+U to send an event (Command+Shift+U on a Mac).",
  "manifest_version": 2,
  "version": "1.0",

  "commands": {
    "toto": {
      "suggested_key": {"default": "Ctrl+Shift+0" } ,
      "description": "Send a 'toggle-feature' event to the extension"
    }
  },

   "background": {
    "scripts": ["ts.js"]
  }
}

和(文件.js):

    browser.commands.onCommand.addListener(function(command) {
  if (command == "toto") {
    console.log("toggling the feature!");
    document.body.style.border = "5px solid red";
  }
});

但没有任何事情发生!

当它不是捷径时它起作用。什么东西挡住了捷径?

0 个答案:

没有答案