mercredi 2 août 2017

Chrome Commands API not working when extension popup is not open

The shortcut command works when I open the extension's popup and then press the keys, but else, even when the browser is focused, it does not work. Shouldn't it work even when the popup is closed? Or am I interpreting it incorrectly? Reqd. manifest.json:

{
  "manifest_version": 2,
  "permissions": [
    "activeTab",
    "tabs",
    "storage"
  ],
  "commands": {
    "convert-name": {
      "suggested_key": {
        "default": "Alt+Shift+P",
        "mac": "Command+Shift+P"
      },
      "description": "Convert the name to link."
    }
  }
}

JS:

chrome.commands.onCommand.addListener(function (command) {
    chrome.tabs.create({url: "http://www.google.com/"});
});

Aucun commentaire:

Enregistrer un commentaire