Method
onMessage
(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
Tested by
no test coverage detected