()
| 235 | } |
| 236 | |
| 237 | function createComponentsPanel() { |
| 238 | if (componentsPortalContainer) { |
| 239 | // Panel is created and user opened it at least once |
| 240 | ensureInitialHTMLIsCleared(componentsPortalContainer); |
| 241 | render('components'); |
| 242 | |
| 243 | return; |
| 244 | } |
| 245 | |
| 246 | if (componentsPanel) { |
| 247 | // Panel is created, but wasn't opened yet, so no document is present for it |
| 248 | return; |
| 249 | } |
| 250 | |
| 251 | chrome.devtools.panels.create( |
| 252 | __IS_CHROME__ || __IS_EDGE__ ? 'Components ⚛' : 'Components', |
| 253 | __IS_EDGE__ ? 'icons/production.svg' : '', |
| 254 | 'panel.html', |
| 255 | createdPanel => { |
| 256 | componentsPanel = createdPanel; |
| 257 | |
| 258 | createdPanel.onShown.addListener(portal => { |
| 259 | componentsPortalContainer = portal.container; |
| 260 | if (componentsPortalContainer != null && render) { |
| 261 | ensureInitialHTMLIsCleared(componentsPortalContainer); |
| 262 | |
| 263 | render('components'); |
| 264 | portal.injectStyles(cloneStyleTags); |
| 265 | |
| 266 | logEvent({event_name: 'selected-components-tab'}); |
| 267 | } |
| 268 | }); |
| 269 | |
| 270 | createdPanel.onShown.addListener(() => { |
| 271 | bridge.emit('extensionComponentsPanelShown'); |
| 272 | }); |
| 273 | createdPanel.onHidden.addListener(() => { |
| 274 | bridge.emit('extensionComponentsPanelHidden'); |
| 275 | }); |
| 276 | }, |
| 277 | ); |
| 278 | } |
| 279 | |
| 280 | function createProfilerPanel() { |
| 281 | if (profilerPortalContainer) { |
no test coverage detected