(backendName: string)
| 369 | } |
| 370 | |
| 371 | removeBackend(backendName: string): void { |
| 372 | if (!(backendName in this.registryFactory)) { |
| 373 | throw new Error(`${backendName} backend not found in registry`); |
| 374 | } |
| 375 | if (this.backendName === backendName && this.pendingBackendInit != null) { |
| 376 | // There is a pending promise of the backend we want to remove. Make it |
| 377 | // obsolete. |
| 378 | this.pendingBackendInitId++; |
| 379 | } |
| 380 | |
| 381 | if (backendName in this.registry) { |
| 382 | this.disposeRegisteredKernels(backendName); |
| 383 | this.registry[backendName].dispose(); |
| 384 | delete this.registry[backendName]; |
| 385 | } |
| 386 | |
| 387 | delete this.registryFactory[backendName]; |
| 388 | |
| 389 | // Unset the backend if it is active. |
| 390 | if (this.backendName === backendName) { |
| 391 | this.pendingBackendInit = null; |
| 392 | this.backendName = null; |
| 393 | this.backendInstance = null; |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | private getSortedBackends(): string[] { |
| 398 | if (Object.keys(this.registryFactory).length === 0) { |
no test coverage detected