Last active
September 21, 2024 03:50
-
-
Save kohki-shikata/d9875c0e2ee5322e8aeb451ec515c144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chrome.runtime.onInstalled.addListener(() => { | |
// console.log("Extension installed!"); | |
// }); | |
// src/background/service-worker.js | |
let myVariable = "This is a variable from the background script."; | |
chrome.runtime.onMessage.addListener((request, _sender, sendResponse) => { | |
if (request.action === "getVariable") { | |
sendResponse({ variable: myVariable }); | |
} | |
}); | |
// chrome.action.onClicked.addListener(async () => { | |
// }); | |
chrome.sidePanel | |
.setPanelBehavior({ openPanelOnActionClick: true }) | |
.catch((error) => console.error(error)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment