* Disconnect from the worker.
()
| 135 | * Disconnect from the worker. |
| 136 | */ |
| 137 | public disconnect(): void { |
| 138 | if (this.worker) { |
| 139 | this.worker.port.postMessage({ |
| 140 | type: WorkerMessageType.DISCONNECT, |
| 141 | rendererId: this.rendererId |
| 142 | }); |
| 143 | this.worker.port.close(); |
| 144 | this.worker = null; |
| 145 | } |
| 146 | this.isConnected = false; |
| 147 | this.connectionPromise = null; |
| 148 | this.connectionResolve = null; |
| 149 | |
| 150 | // Resolve pending callbacks with prevent_update so loading states clear |
| 151 | for (const [, pending] of this.pendingCallbacks) { |
| 152 | pending.resolve({status: 'prevent_update'}); |
| 153 | } |
| 154 | this.pendingCallbacks.clear(); |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * Ensure the worker is connected, initiating connection if needed. |
no test coverage detected