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

Method onMessage

packages/message/mock_message.ts:11–20  ·  view source on GitHub ↗
(callback: (data: TMessage) => void)

Source from the content-addressed store, hash-verified

9 }
10
11 onMessage(callback: (data: TMessage) => void): void {
12 if (!this.EE) {
13 console.error("onMessage Invalid MockConnection");
14 // 無法監聽的話不应该屏蔽错误
15 throw new Error("onMessage Invalid MockConnection");
16 }
17 this.EE.on("message", (data: any) => {
18 callback(data);
19 });
20 }
21
22 sendMessage(data: TMessage): void {
23 if (!this.EE) {

Callers

nothing calls this directly

Calls 3

callbackFunction · 0.85
errorMethod · 0.80
onMethod · 0.45

Tested by

no test coverage detected