a
Some checks failed
build / Build (push) Failing after 9s
test / Run tests (push) Failing after 11s
Some checks failed
build / Build (push) Failing after 9s
test / Run tests (push) Failing after 11s
This commit is contained in:
parent
3c238bcdc8
commit
9b9513fea5
@ -22,29 +22,7 @@ export default class ServiceWorkerManager {
|
|||||||
// 准备好环境
|
// 准备好环境
|
||||||
this.mq.emit("preparationOffscreen", {});
|
this.mq.emit("preparationOffscreen", {});
|
||||||
|
|
||||||
const ctx = await chrome.runtime.getContexts({
|
// sendMessageToOffscreen("preparationOffscreen", {});
|
||||||
contextTypes: [chrome.runtime.ContextType.OFFSCREEN_DOCUMENT],
|
|
||||||
documentUrls: [chrome.runtime.getURL("src/offscreen.html")],
|
|
||||||
});
|
|
||||||
console.log("ctx", ctx, chrome.runtime.getURL("src/offscreen.html"));
|
|
||||||
chrome.scripting.executeScript({
|
|
||||||
target: {
|
|
||||||
documentIds: [ctx[0]!.documentId!],
|
|
||||||
tabId: -1,
|
|
||||||
},
|
|
||||||
func: (message) => {
|
|
||||||
// 在页面上下文中执行的代码
|
|
||||||
console.log("tesss");
|
|
||||||
window.postMessage(
|
|
||||||
{
|
|
||||||
type: "sendMessage",
|
|
||||||
daat: message,
|
|
||||||
},
|
|
||||||
"*"
|
|
||||||
);
|
|
||||||
},
|
|
||||||
args: [{ action: "test", data: "test" }],
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const resource = new ResourceService(group.group("resource"), this.mq);
|
const resource = new ResourceService(group.group("resource"), this.mq);
|
||||||
|
2
src/types/main.d.ts
vendored
2
src/types/main.d.ts
vendored
@ -5,7 +5,7 @@ declare module "*.yaml";
|
|||||||
|
|
||||||
declare const sandbox: Window;
|
declare const sandbox: Window;
|
||||||
|
|
||||||
declare const clients: Clients;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
declare namespace GMSend {
|
declare namespace GMSend {
|
||||||
interface XHRDetails {
|
interface XHRDetails {
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"lib": [
|
"lib": [
|
||||||
"DOM",
|
"DOM",
|
||||||
"ES2020"
|
"ES2020",
|
||||||
|
"WebWorker"
|
||||||
],
|
],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user