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

Method constructor

ch2-patterns/rpc-worker.js:2–7  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

1class RpcWorker {
2 constructor(path) {
3 this.next_command_id = 0;
4 this.in_flight_commands = new Map();
5 this.worker = new Worker(path);
6 this.worker.onmessage = this.onMessageHandler.bind(this);
7 }
8// THIS LINE SHOULD NOT APPEAR IN PRINT
9 onMessageHandler(msg) {
10 const { result, error, id } = msg.data;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected