MCPcopy Index your code
hub / github.com/react/react / Agent

Class Agent

packages/react-devtools-shared/src/backend/agent.js:144–988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142};
143
144export default class Agent extends EventEmitter<{
145 hideNativeHighlight: [],
146 showNativeHighlight: [HostInstance],
147 startInspectingNative: [],
148 stopInspectingNative: [],
149 shutdown: [],
150 traceUpdates: [Set<HostInstance>],
151 drawTraceUpdates: [Array<HostInstance>],
152 drawGroupedTraceUpdatesWithNames: [Array<Array<GroupItem>>],
153 disableTraceUpdates: [],
154 getIfHasUnsupportedRendererVersion: [],
155 updateHookSettings: [$ReadOnly<DevToolsHookSettings>],
156 getHookSettings: [],
157}> {
158 _bridge: BackendBridge;
159 _isProfiling: boolean = false;
160 _rendererInterfaces: {[key: RendererID]: RendererInterface, ...} = {};
161 _persistedSelection: PersistedSelection | null = null;
162 _persistedSelectionMatch: PathMatch | null = null;
163 _traceUpdatesEnabled: boolean = false;
164 _onReloadAndProfile:
165 | ((recordChangeDescriptions: boolean, recordTimeline: boolean) => void)
166 | void;
167
168 constructor(
169 bridge: BackendBridge,
170 isProfiling: boolean = false,
171 onReloadAndProfile?: (
172 recordChangeDescriptions: boolean,
173 recordTimeline: boolean,
174 ) => void,
175 ) {
176 super();
177
178 this._isProfiling = isProfiling;
179 this._onReloadAndProfile = onReloadAndProfile;
180
181 const persistedSelectionString = sessionStorageGetItem(
182 SESSION_STORAGE_LAST_SELECTION_KEY,
183 );
184 if (persistedSelectionString != null) {
185 this._persistedSelection = JSON.parse(persistedSelectionString);
186 }
187
188 this._bridge = bridge;
189
190 bridge.addListener('clearErrorsAndWarnings', this.clearErrorsAndWarnings);
191 bridge.addListener('clearErrorsForElementID', this.clearErrorsForElementID);
192 bridge.addListener(
193 'clearWarningsForElementID',
194 this.clearWarningsForElementID,
195 );
196 bridge.addListener('copyElementPath', this.copyElementPath);
197 bridge.addListener('deletePath', this.deletePath);
198 bridge.addListener('getBackendVersion', this.getBackendVersion);
199 bridge.addListener('getBridgeProtocol', this.getBridgeProtocol);
200 bridge.addListener('getProfilingData', this.getProfilingData);
201 bridge.addListener('getProfilingStatus', this.getProfilingStatus);

Callers

nothing calls this directly

Calls 11

selectNodeMethod · 0.95
sessionStorageSetItemFunction · 0.90
sessionStorageRemoveItemFunction · 0.90
removeAllListenersMethod · 0.80
startProfilingMethod · 0.80
stopProfilingMethod · 0.80
joinMethod · 0.80
debugFunction · 0.70
pushMethod · 0.65
setTraceUpdatesEnabledFunction · 0.50
emitMethod · 0.45

Tested by

no test coverage detected