Home / File/ backendManager.js — react Source File

backendManager.js — react Source File

Architecture documentation for backendManager.js, a javascript file in the react codebase. 4 imports, 0 dependents.

File javascript BabelCompiler Validation 4 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  90e8e836_8a48_d6c0_6325_60776b1ad6d2["backendManager.js"]
  40bf6909_04ae_bfb6_965f_14cfe98b94de["types"]
  90e8e836_8a48_d6c0_6325_60776b1ad6d2 --> 40bf6909_04ae_bfb6_965f_14cfe98b94de
  80162ac2_4fc9_259b_04e9_4acc940af136["utils"]
  90e8e836_8a48_d6c0_6325_60776b1ad6d2 --> 80162ac2_4fc9_259b_04e9_4acc940af136
  b532d250_f821_6a52_3f38_5c3c2f444a28["utils"]
  90e8e836_8a48_d6c0_6325_60776b1ad6d2 --> b532d250_f821_6a52_3f38_5c3c2f444a28
  627bb742_21aa_b4fd_fe2d_4a963a1f9278["utils"]
  90e8e836_8a48_d6c0_6325_60776b1ad6d2 --> 627bb742_21aa_b4fd_fe2d_4a963a1f9278
  style 90e8e836_8a48_d6c0_6325_60776b1ad6d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import type {
  DevToolsHook,
  ReactRenderer,
} from 'react-devtools-shared/src/backend/types';
import {hasAssignedBackend} from 'react-devtools-shared/src/backend/utils';
import {COMPACT_VERSION_NAME} from 'react-devtools-extensions/src/utils';
import {getIsReloadAndProfileSupported} from 'react-devtools-shared/src/utils';
import {
  getIfReloadedAndProfiling,
  onReloadAndProfile,
  onReloadAndProfileFlagsReset,
} from 'react-devtools-shared/src/utils';

let welcomeHasInitialized = false;
const requiredBackends = new Set<string>();

function welcome(event: $FlowFixMe) {
  if (
    event.source !== window ||
    event.data.source !== 'react-devtools-content-script'
  ) {
    return;
  }

  // In some circumstances, this method is called more than once for a single welcome message.
  // The exact circumstances of this are unclear, though it seems related to 3rd party event batching code.
  //
  // Regardless, call this method multiple times can cause DevTools to add duplicate elements to the Store
  // (and throw an error) or worse yet, choke up entirely and freeze the browser.
  //
  // The simplest solution is to ignore the duplicate events.
  // To be clear, this SHOULD NOT BE NECESSARY, since we remove the event handler below.
  //
  // See https://github.com/facebook/react/issues/24162
  if (welcomeHasInitialized) {
    console.warn(
      'React DevTools detected duplicate welcome "message" events from the content script.',
    );
    return;
  }

  welcomeHasInitialized = true;

  window.removeEventListener('message', welcome);

  setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__);
}

function setup(hook: ?DevToolsHook) {
  // this should not happen, but Chrome can be weird sometimes
  if (hook == null) {
// ... (151 more lines)

Domain

Subdomains

Dependencies

  • types
  • utils
  • utils
  • utils

Frequently Asked Questions

What does backendManager.js do?
backendManager.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in backendManager.js?
backendManager.js defines 5 function(s): activateBackend, registerRenderer, setup, updateRequiredBackends, welcome.
What does backendManager.js depend on?
backendManager.js imports 4 module(s): types, utils, utils, utils.
Where is backendManager.js in the architecture?
backendManager.js is located at packages/react-devtools-extensions/src/contentScripts/backendManager.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-extensions/src/contentScripts).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free