This commit is contained in:
2024-12-20 18:05:18 +08:00
parent 177594b638
commit d15e9171f7
9 changed files with 142 additions and 590 deletions

View File

@ -1,9 +1,9 @@
export type ApiFunction = (params: any, con: chrome.runtime.Port | chrome.runtime.MessageSender) => any;
export class Server {
apiFunctionMap: Map<string, ApiFunction> = new Map();
private apiFunctionMap: Map<string, ApiFunction> = new Map();
constructor() {
constructor(private env: string) {
chrome.runtime.onConnect.addListener((port) => {
port.onMessage.addListener((msg: { action: string }) => {
this.connectHandle(msg.action, msg, port);