34 lines
820 B
JavaScript
34 lines
820 B
JavaScript
// function onError(error) {
|
|
// console.error(`Error in background script: ${error}`);
|
|
// }
|
|
|
|
// function handleMessage(request, sender, sendResponse){
|
|
// console.log("In background : " + request.command)
|
|
|
|
// browser.tabs.query({
|
|
// currentWindow: true,
|
|
// active: true
|
|
// }).then(sendMessageToTabs)
|
|
// .then(() => sendResponse({title: "No title yet"})
|
|
// )
|
|
// .catch(onError);
|
|
|
|
// }
|
|
|
|
// function sendMessageToTabs (tabs){
|
|
// for(let tab of tabs){
|
|
// browser.tabs.sendMessage(
|
|
// tab.id,
|
|
// {content: "get-title"}
|
|
// ).then(response => {
|
|
// console.log("Message from content script : " + response)
|
|
// }).catch(onError)
|
|
// }
|
|
// }
|
|
|
|
// browser.runtime.onMessage.addListener(handleMessage);
|
|
|
|
|
|
// // "background": {
|
|
// // "scripts": ["background-script.js"]
|
|
// // },
|