samoware-multisave/background.js
2025-08-28 21:06:45 +02:00

20 lines
650 B
JavaScript

console.log("background.js started!");
function handlePageactionClick(tab, onClickData) {
console.log("background.js: executing content script");
let executing = browser.tabs.executeScript({file: "/contentscript.js"})
executing.then(onExecuted, onExecutionError);
}
function onExecuted(result) {
console.log(`background.js: content script execution successful with result: ${result}`);
}
function onExecutionError(error) {
console.error(`background.js: The following error occured while executing a content script: ${error}`);
}
// add listener for the extension button
browser.pageAction.onClicked.addListener(handlePageactionClick);