Home / File/ elementSelection.js — react Source File

elementSelection.js — react Source File

Architecture documentation for elementSelection.js, a javascript file in the react codebase. 1 imports, 1 dependents.

File javascript BabelCompiler Validation 1 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  4f973625_4ea3_727f_a21d_315a6a251079["elementSelection.js"]
  5da5ec89_70b9_80cd_1b31_dcf27eddc57e["evalInInspectedWindow.js"]
  4f973625_4ea3_727f_a21d_315a6a251079 --> 5da5ec89_70b9_80cd_1b31_dcf27eddc57e
  b5e42467_7633_e234_1d51_a93bfc4818c7["index.js"]
  b5e42467_7633_e234_1d51_a93bfc4818c7 --> 4f973625_4ea3_727f_a21d_315a6a251079
  style 4f973625_4ea3_727f_a21d_315a6a251079 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {evalInInspectedWindow} from './evalInInspectedWindow';

export function setBrowserSelectionFromReact() {
  // This is currently only called on demand when you press "view DOM".
  // In the future, if Chrome adds an inspect() that doesn't switch tabs,
  // we could make this happen automatically when you select another component.
  evalInInspectedWindow(
    'setBrowserSelectionFromReact',
    [],
    (didSelectionChange, evalError) => {
      if (evalError) {
        console.error(evalError);
      }
    },
  );
}

export function setReactSelectionFromBrowser(bridge) {
  // When the user chooses a different node in the browser Elements tab,
  // copy it over to the hook object so that we can sync the selection.
  evalInInspectedWindow(
    'setReactSelectionFromBrowser',
    [],
    (didSelectionChange, evalError) => {
      if (evalError) {
        console.error(evalError);
      } else if (didSelectionChange) {
        if (!bridge) {
          console.error(
            'Browser element selection changed, but bridge was not initialized',
          );
          return;
        }

        // Remember to sync the selection next time we show inspected element
        bridge.send('syncSelectionFromBuiltinElementsPanel');
      }
    },
  );
}

Domain

Subdomains

Frequently Asked Questions

What does elementSelection.js do?
elementSelection.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 elementSelection.js?
elementSelection.js defines 2 function(s): setBrowserSelectionFromReact, setReactSelectionFromBrowser.
What does elementSelection.js depend on?
elementSelection.js imports 1 module(s): evalInInspectedWindow.js.
What files import elementSelection.js?
elementSelection.js is imported by 1 file(s): index.js.
Where is elementSelection.js in the architecture?
elementSelection.js is located at packages/react-devtools-extensions/src/main/elementSelection.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-extensions/src/main).

Analyze Your Own Codebase

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

Try Supermodel Free