MCPcopy
hub / github.com/facebook/react / createProfilerPanel

Function createProfilerPanel

packages/react-devtools-extensions/src/main/index.js:280–314  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

278}
279
280function createProfilerPanel() {
281 if (profilerPortalContainer) {
282 // Panel is created and user opened it at least once
283 ensureInitialHTMLIsCleared(profilerPortalContainer);
284 render('profiler');
285
286 return;
287 }
288
289 if (profilerPanel) {
290 // Panel is created, but wasn't opened yet, so no document is present for it
291 return;
292 }
293
294 chrome.devtools.panels.create(
295 __IS_CHROME__ || __IS_EDGE__ ? 'Profiler ⚛' : 'Profiler',
296 __IS_EDGE__ ? 'icons/production.svg' : '',
297 'panel.html',
298 createdPanel => {
299 profilerPanel = createdPanel;
300
301 createdPanel.onShown.addListener(portal => {
302 profilerPortalContainer = portal.container;
303 if (profilerPortalContainer != null && render) {
304 ensureInitialHTMLIsCleared(profilerPortalContainer);
305
306 render('profiler');
307 portal.injectStyles(cloneStyleTags);
308
309 logEvent({event_name: 'selected-profiler-tab'});
310 }
311 });
312 },
313 );
314}
315
316function createSourcesEditorPanel() {
317 if (editorPortalContainer) {

Callers 1

mountReactDevToolsFunction · 0.85

Calls 5

logEventFunction · 0.90
createMethod · 0.65
addListenerMethod · 0.65
renderFunction · 0.50

Tested by

no test coverage detected