Answer the question
In order to leave comments, you need to log in
Why don't functions from Background.js Chrome Extension work?
Good afternoon, there is an extension for chrome, it works on the VueJS framework - https://github.com/Kocal/vue-web-extension , according to the logic, the function from background.js should work
Manifest file
"background": {
"persistent": true,
"scripts": [
"scripts/background.js"
]
},
function pause() {
chrome.browserAction.setIcon({path: '/images/icon_player.png'});
.....
}
, called by the chrome.extension.getBackgroundPage().pause() method, but gives an error that there is no such function, what could be the problem?
Answer the question
In order to leave comments, you need to log in
Found a solution:
background.js
chrome.extension.onMessage.addListener((message) => {
switch (message.type){
case 'pause':
return pause()
case 'setStream':
return setStream(message.data)
}
});
chrome.extension.sendMessage({
type: "setStream",
data: {....}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question