(method, ...args)
| 33 | } |
| 34 | // THIS LINE SHOULD NOT APPEAR IN PRINT |
| 35 | exec(method, ...args) { |
| 36 | const id = ++this.next_command_id; |
| 37 | let resolve, reject; |
| 38 | const promise = new Promise((res, rej) => { resolve = res; reject = rej; }); |
| 39 | const worker = this.getWorker(); // <1> |
| 40 | worker.in_flight_commands.set(id, { resolve, reject }); |
| 41 | worker.worker.postMessage({ method, params: args, id }); |
| 42 | return promise; |
| 43 | } |
| 44 | // THIS LINE SHOULD NOT APPEAR IN PRINT |
| 45 | getWorker() { |
| 46 | let id; |