MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / constructor

Method constructor

packages/message/message_queue.ts:43–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 private EE = new EventEmitter<string, any>();
42
43 constructor() {
44 chrome.runtime.onMessage.addListener((msg: TMessage) => {
45 const lastError = chrome.runtime.lastError;
46 const topic = msg.msgQueue;
47 if (typeof topic !== "string") return;
48 if (lastError) {
49 console.error("chrome.runtime.lastError in chrome.runtime.onMessage:", lastError);
50 // 消息API发生错误因此不继续执行
51 return false;
52 }
53 this.handler(topic, msg.data);
54 });
55 }
56
57 handler(topic: string, { action, message }: { action: string; message: any }) {
58 LoggerCore.getInstance()

Callers

nothing calls this directly

Calls 3

handlerMethod · 0.95
errorMethod · 0.80
addListenerMethod · 0.65

Tested by

no test coverage detected