快捷键Chrome扩展程序不起作用

时间:2018-07-01 14:20:46

标签: javascript google-chrome google-chrome-extension

当我尝试为我的新扩展程序Chrome添加一些快捷键键盘时,它不起作用。当我尝试使用此行检查命令时:

chrome.commands.getAll(command => { alert(JSON.stringify(command)) })

描述和名称正确显示,但是快捷方式属性呈现一个空字符串。我尝试了很多快捷方式,然后删除并重新安装未打包的扩展程序,但这并不总是可行。

我的manifest.json:

{
    "manifest_version": 2,
    "name": "myfirstext",
    "version": "1.0.0",

    "description": "blablabla",

    "author": {
        "name": "Ben Lmsc",
        "url": "https://github.com"
    },
    "background": {
        "scripts": ["js/main.js"]
    },
    "browser_action": {
        "default_popup": "index.html"
    },
    "commands": {
        "handle_my_key": {
            "suggested_key": {
                "default": "Ctrl+Shift+L"
            },
            "description": "Description of my shortcut"
        }
    },
    "icons": {
        "16": "img/LOGO_16.png",
        "32": "img/LOGO_32.png",
        "48": "img/LOGO_48.png",
        "128": "img/LOGO_128.png"
    },
    "permissions": [
        "http://*/*",
        "https://*/*",
        "notifications"
    ]
}

0 个答案:

没有答案