(method, ...args)
| 15 | } |
| 16 | // THIS LINE SHOULD NOT APPEAR IN PRINT |
| 17 | exec(method, ...args) { |
| 18 | const id = ++this.next_command_id; |
| 19 | let resolve, reject; |
| 20 | const promise = new Promise((res, rej) => { |
| 21 | resolve = res; |
| 22 | reject = rej; |
| 23 | }); |
| 24 | this.in_flight_commands.set(id, { resolve, reject }); |
| 25 | this.worker.postMessage({ method, params: args, id }); |
| 26 | return promise; |
| 27 | } |
| 28 | } |