mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-01 17:43:15 +00:00
feat(extension): migrate chrome extension v2 to v3
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="background.js"></script>
|
||||
</head>
|
||||
</html>
|
||||
@@ -1,22 +0,0 @@
|
||||
// if you checked "fancy-settings" in extensionizr.com, uncomment this lines
|
||||
|
||||
// var settings = new Store("settings", {
|
||||
// "sample_setting": "This is how you use Store.js to remember values"
|
||||
// });
|
||||
|
||||
|
||||
//example of using a message handler from the inject scripts
|
||||
chrome.extension.onMessage.addListener(
|
||||
function(request, sender, sendResponse) {
|
||||
chrome.pageAction.show(sender.tab.id);
|
||||
sendResponse();
|
||||
});
|
||||
|
||||
|
||||
chrome.runtime.onMessage.addListener(
|
||||
function(request, sender, sendResponse) {
|
||||
if (request.msg === "sendMessage") {
|
||||
sendResponse({response: "Message received"});
|
||||
}
|
||||
});
|
||||
|
||||
12
extensions/chrome/src/bg/service-worker.js
Normal file
12
extensions/chrome/src/bg/service-worker.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// This is the service worker script, which executes in its own context
|
||||
// when the extension is installed or refreshed (or when you access its console).
|
||||
// It would correspond to the background script in chrome extensions v2.
|
||||
|
||||
console.log("This prints to the console of the service worker (background script)");
|
||||
chrome.runtime.onMessage.addListener(
|
||||
function(request, sender, sendResponse) {
|
||||
if (request.msg === "sendMessage") {
|
||||
sendResponse({response: "Message received"});
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user