Skip to content

Commit

Permalink
[DevTools] Separate RDT Fusebox into single-panel entry points
Browse files Browse the repository at this point in the history
  • Loading branch information
huntie committed Aug 14, 2024
1 parent 2a54019 commit 3675274
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/react-devtools-fusebox/src/frontend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ export type InitializationOptions = {
canViewElementSourceFunction?: CanViewElementSource,
};

export function initialize(node: Element | Document, options: InitializationOptions): void;
export function initializeComponents(node: Element | Document, options: InitializationOptions): void;
export function initializeProfiler(node: Element | Document, options: InitializationOptions): void;
26 changes: 22 additions & 4 deletions packages/react-devtools-fusebox/src/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import type {
} from 'react-devtools-shared/src/frontend/types';
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
import type {
CanViewElementSource,
TabID,
ViewAttributeSource,
ViewElementSource,
CanViewElementSource,
} from 'react-devtools-shared/src/devtools/views/DevTools';
import type {Config} from 'react-devtools-shared/src/devtools/store';

Expand Down Expand Up @@ -51,10 +52,11 @@ type InitializationOptions = {
canViewElementSourceFunction?: CanViewElementSource,
};

export function initialize(
function initializeTab(
tab: TabID,
contentWindow: Element | Document,
options: InitializationOptions,
): void {
) {
const {
bridge,
store,
Expand All @@ -70,7 +72,8 @@ export function initialize(
bridge={bridge}
browserTheme={theme}
store={store}
showTabBar={true}
showTabBar={false}
overrideTab={tab}
warnIfLegacyBackendDetected={true}
enabledInspectedElementContextMenu={true}
viewAttributeSourceFunction={viewAttributeSourceFunction}
Expand All @@ -79,3 +82,18 @@ export function initialize(
/>,
);
}

export function initializeComponents(
contentWindow: Element | Document,
options: InitializationOptions,
): void {
initializeTab('components', contentWindow, options);
}


export function initializeProfiler(
contentWindow: Element | Document,
options: InitializationOptions,
): void {
initializeTab('profiler', contentWindow, options);
}

0 comments on commit 3675274

Please sign in to comment.