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

Function initializeTab

packages/react-devtools-fusebox/src/frontend.js:57–102  ·  view source on GitHub ↗
(
  tab: TabID,
  contentWindow: Element | Document,
  options: InitializationOptions,
)

Source from the content-addressed store, hash-verified

55};
56
57function initializeTab(
58 tab: TabID,
59 contentWindow: Element | Document,
60 options: InitializationOptions,
61) {
62 const {
63 bridge,
64 store,
65 theme = 'light',
66 viewAttributeSourceFunction,
67 viewElementSourceFunction,
68 canViewElementSourceFunction,
69 fetchFileWithCaching,
70 } = options;
71 const root = createRoot(contentWindow);
72
73 root.render(
74 <DevTools
75 bridge={bridge}
76 browserTheme={theme}
77 store={store}
78 showTabBar={false}
79 overrideTab={tab}
80 warnIfLegacyBackendDetected={true}
81 enabledInspectedElementContextMenu={true}
82 viewAttributeSourceFunction={viewAttributeSourceFunction}
83 viewElementSourceFunction={viewElementSourceFunction}
84 canViewElementSourceFunction={canViewElementSourceFunction}
85 fetchFileWithCaching={fetchFileWithCaching}
86 />,
87 );
88}
89
90export function initializeComponents(
91 contentWindow: Element | Document,
92 options: InitializationOptions,
93): void {
94 initializeTab('components', contentWindow, options);
95}
96
97export function initializeProfiler(
98 contentWindow: Element | Document,
99 options: InitializationOptions,
100): void {
101 initializeTab('profiler', contentWindow, options);
102}

Callers

nothing calls this directly

Calls 1

createRootFunction · 0.90

Tested by

no test coverage detected