@@ -227,47 +227,57 @@ function createPanelIfReactLoaded() {
227227 let currentPanel = null ;
228228 let needsToSyncElementSelection = false ;
229229
230- chrome . devtools . panels . create ( '⚛ Components' , '' , 'panel.html' , panel => {
231- panel . onShown . addListener ( ( ) => {
232- if ( needsToSyncElementSelection ) {
233- needsToSyncElementSelection = false ;
234- bridge . send ( 'syncSelectionFromNativeElementsPanel' ) ;
235- }
230+ chrome . devtools . panels . create (
231+ '⚛ Components' ,
232+ '' ,
233+ 'panel.html' ,
234+ extensionPanel => {
235+ extensionPanel . onShown . addListener ( panel => {
236+ if ( needsToSyncElementSelection ) {
237+ needsToSyncElementSelection = false ;
238+ bridge . send ( 'syncSelectionFromNativeElementsPanel' ) ;
239+ }
236240
237- if ( currentPanel === panel ) {
238- return ;
239- }
241+ if ( currentPanel === panel ) {
242+ return ;
243+ }
240244
241- currentPanel = panel ;
242- componentsPortalContainer = panel . container ;
245+ currentPanel = panel ;
246+ componentsPortalContainer = panel . container ;
243247
244- if ( componentsPortalContainer != null ) {
245- ensureInitialHTMLIsCleared ( componentsPortalContainer ) ;
246- render ( 'components' ) ;
247- panel . injectStyles ( cloneStyleTags ) ;
248- }
249- } ) ;
250- panel . onHidden . addListener ( ( ) => {
251- // TODO: Stop highlighting and stuff.
252- } ) ;
253- } ) ;
248+ if ( componentsPortalContainer != null ) {
249+ ensureInitialHTMLIsCleared ( componentsPortalContainer ) ;
250+ render ( 'components' ) ;
251+ panel . injectStyles ( cloneStyleTags ) ;
252+ }
253+ } ) ;
254+ extensionPanel . onHidden . addListener ( panel => {
255+ // TODO: Stop highlighting and stuff.
256+ } ) ;
257+ } ,
258+ ) ;
254259
255- chrome . devtools . panels . create ( '⚛ Profiler' , '' , 'panel.html' , panel => {
256- panel . onShown . addListener ( ( ) => {
257- if ( currentPanel === panel ) {
258- return ;
259- }
260+ chrome . devtools . panels . create (
261+ '⚛ Profiler' ,
262+ '' ,
263+ 'panel.html' ,
264+ extensionPanel => {
265+ extensionPanel . onShown . addListener ( panel => {
266+ if ( currentPanel === panel ) {
267+ return ;
268+ }
260269
261- currentPanel = panel ;
262- profilerPortalContainer = panel . container ;
270+ currentPanel = panel ;
271+ profilerPortalContainer = panel . container ;
263272
264- if ( profilerPortalContainer != null ) {
265- ensureInitialHTMLIsCleared ( profilerPortalContainer ) ;
266- render ( 'profiler' ) ;
267- panel . injectStyles ( cloneStyleTags ) ;
268- }
269- } ) ;
270- } ) ;
273+ if ( profilerPortalContainer != null ) {
274+ ensureInitialHTMLIsCleared ( profilerPortalContainer ) ;
275+ render ( 'profiler' ) ;
276+ panel . injectStyles ( cloneStyleTags ) ;
277+ }
278+ } ) ;
279+ } ,
280+ ) ;
271281
272282 chrome . devtools . network . onNavigated . removeListener ( checkPageForReact ) ;
273283
0 commit comments