()
| 575 | } |
| 576 | |
| 577 | private activate(): void { |
| 578 | if (this.disposed) { |
| 579 | return |
| 580 | } |
| 581 | |
| 582 | const activeBridgeByHookId = getActiveBridgeRegistry() |
| 583 | const activeBridge = activeBridgeByHookId.get(this.options.hookId) |
| 584 | if (activeBridge && activeBridge !== this) { |
| 585 | if (typeof activeBridge.supersede === 'function') { |
| 586 | activeBridge.supersede() |
| 587 | } else { |
| 588 | activeBridge.deactivate() |
| 589 | } |
| 590 | } |
| 591 | activeBridgeByHookId.set(this.options.hookId, this) |
| 592 | |
| 593 | if (this.unsubscribers.length > 0) { |
| 594 | return |
| 595 | } |
| 596 | |
| 597 | this.unsubscribers.push( |
| 598 | aiEventClient.on('devtools:request-state', (event) => { |
| 599 | this.handleRequestState(event) |
| 600 | }), |
| 601 | ) |
| 602 | |
| 603 | if (this.options.applyToolFixture) { |
| 604 | this.unsubscribers.push( |
| 605 | aiEventClient.on('devtools:tool-fixture:apply', (event) => { |
| 606 | void this.handleToolFixtureApply(event) |
| 607 | }), |
| 608 | ) |
| 609 | } |
| 610 | } |
| 611 | |
| 612 | private handleRequestState( |
| 613 | event: AIDevtoolsEvent<{ targetHookId?: string }>, |
no test coverage detected