(hub: Hub, container: Container, state: ExplainViewState)
| 117 | private pendingCompilationResult: CompilationResult | null = null; |
| 118 | |
| 119 | constructor(hub: Hub, container: Container, state: ExplainViewState) { |
| 120 | super(hub, container, state); |
| 121 | |
| 122 | this.explainApiEndpoint = options.explainApiEndpoint ?? ''; |
| 123 | |
| 124 | // Initialize static cache if not already done |
| 125 | if (!ExplainView.cache) { |
| 126 | ExplainView.cache = new LRUCache({ |
| 127 | maxSize: 200 * 1024, |
| 128 | sizeCalculation: n => JSON.stringify(n).length, |
| 129 | }); |
| 130 | } |
| 131 | |
| 132 | this.statusIcon = this.domRoot.find('.status-icon'); |
| 133 | this.consentElement = this.domRoot.find('.explain-consent'); |
| 134 | this.noAiElement = this.domRoot.find('.explain-no-ai'); |
| 135 | this.contentElement = this.domRoot.find('.explain-content'); |
| 136 | this.bottomBarElement = this.domRoot.find('.explain-bottom-bar'); |
| 137 | this.statsElement = this.domRoot.find('.explain-stats'); |
| 138 | this.audienceSelect = this.domRoot.find('.explain-audience'); |
| 139 | this.explanationSelect = this.domRoot.find('.explain-type'); |
| 140 | this.audienceInfoButton = this.domRoot.find('.explain-audience-info'); |
| 141 | this.explanationInfoButton = this.domRoot.find('.explain-type-info'); |
| 142 | |
| 143 | this.fontScale = new FontScale(this.domRoot, state, '.explain-content'); |
| 144 | this.fontScale.on('change', this.updateState.bind(this)); |
| 145 | |
| 146 | this.attachEventListeners(); |
| 147 | void this.initializeOptions(); |
| 148 | |
| 149 | this.contentElement.text('Waiting for compilation...'); |
| 150 | this.isAwaitingInitialResults = true; |
| 151 | this.eventHub.emit('explainViewOpened', this.compilerInfo.compilerId); |
| 152 | } |
| 153 | |
| 154 | private handleConsentClick(): void { |
| 155 | ExplainView.consentGiven = true; |
nothing calls this directly
no test coverage detected