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

Method constructor

packages/react-devtools-shared/src/devtools/store.js:218–295  ·  view source on GitHub ↗
(bridge: FrontendBridge, config?: Config)

Source from the content-addressed store, hash-verified

216 _maximumRecordedDepth = 0;
217
218 constructor(bridge: FrontendBridge, config?: Config) {
219 super();
220
221 if (__DEBUG__) {
222 debug('constructor', 'subscribing to Bridge');
223 }
224
225 this._collapseNodesByDefault =
226 localStorageGetItem(LOCAL_STORAGE_COLLAPSE_ROOTS_BY_DEFAULT_KEY) ===
227 'true';
228
229 this._recordChangeDescriptions =
230 localStorageGetItem(LOCAL_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY) ===
231 'true';
232
233 this._componentFilters = getSavedComponentFilters();
234
235 let isProfiling = false;
236 if (config != null) {
237 isProfiling = config.isProfiling === true;
238
239 const {
240 supportsInspectMatchingDOMElement,
241 supportsClickToInspect,
242 supportsReloadAndProfile,
243 supportsTimeline,
244 supportsTraceUpdates,
245 checkBridgeProtocolCompatibility,
246 } = config;
247 if (supportsInspectMatchingDOMElement) {
248 this._supportsInspectMatchingDOMElement = true;
249 }
250 if (supportsClickToInspect) {
251 this._supportsClickToInspect = true;
252 }
253 if (supportsReloadAndProfile) {
254 this._isReloadAndProfileFrontendSupported = true;
255 }
256 if (supportsTimeline) {
257 this._supportsTimeline = true;
258 }
259 if (supportsTraceUpdates) {
260 this._supportsTraceUpdates = true;
261 }
262 if (checkBridgeProtocolCompatibility) {
263 this._shouldCheckBridgeProtocolCompatibility = true;
264 }
265 }
266
267 this._bridge = bridge;
268 bridge.addListener('operations', this.onBridgeOperations);
269 bridge.addListener(
270 'overrideComponentFilters',
271 this.onBridgeOverrideComponentFilters,
272 );
273 bridge.addListener('shutdown', this.onBridgeShutdown);
274 bridge.addListener(
275 'isReloadAndProfileSupportedByBackend',

Callers

nothing calls this directly

Calls 4

localStorageGetItemFunction · 0.90
getSavedComponentFiltersFunction · 0.90
debugFunction · 0.70
addListenerMethod · 0.65

Tested by

no test coverage detected