MCPcopy Create free account
hub / github.com/MultithreadedJSBook/code-samples / onMessageHandler

Method onMessageHandler

ch2-patterns/rpc-worker.js:9–15  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

7 }
8// THIS LINE SHOULD NOT APPEAR IN PRINT
9 onMessageHandler(msg) {
10 const { result, error, id } = msg.data;
11 const { resolve, reject } = this.in_flight_commands.get(id);
12 this.in_flight_commands.delete(id);
13 if (error) reject(error);
14 else resolve(result);
15 }
16// THIS LINE SHOULD NOT APPEAR IN PRINT
17 exec(method, ...args) {
18 const id = ++this.next_command_id;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected