Cannot read properties of undefined (reading 'setBadgeText')
is the Error messages i get when I try to trigger a Hotkey Event
Here is my Manifest:
{
"name": "Command demo - basic",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"browser.action": {
"default_popup": "popup.html"
},
"commands": {
"inject-script": {
"suggested_key": "Ctrl+Shift+Y",
"description": "Inject a script on the page"
}
}
}
Here is my background.js code
chrome.commands.onCommand.addListener((command) => {
chrome.browserAction.setBadgeText({ })
});
Pretty simple, yet it dosen't work.
If I change the:
chrome.browserAction.setBadgeText({ })
to
console.log("Hello")
it works just fine. I don't have a setBadgeText permission or something, but there is nothing about about a permission mentioned in the Documentation