Home / Function/ welcome() — react Function Reference

welcome() — react Function Reference

Architecture documentation for the welcome() function in backendManager.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  96d7c41f_0ad6_adfa_e1d8_c54daa214f95["welcome()"]
  90e8e836_8a48_d6c0_6325_60776b1ad6d2["backendManager.js"]
  96d7c41f_0ad6_adfa_e1d8_c54daa214f95 -->|defined in| 90e8e836_8a48_d6c0_6325_60776b1ad6d2
  74df88b7_2c4d_b47c_87ff_25f127f61424["setup()"]
  96d7c41f_0ad6_adfa_e1d8_c54daa214f95 -->|calls| 74df88b7_2c4d_b47c_87ff_25f127f61424
  style 96d7c41f_0ad6_adfa_e1d8_c54daa214f95 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/src/contentScripts/backendManager.js lines 26–56

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__);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does welcome() do?
welcome() is a function in the react codebase, defined in packages/react-devtools-extensions/src/contentScripts/backendManager.js.
Where is welcome() defined?
welcome() is defined in packages/react-devtools-extensions/src/contentScripts/backendManager.js at line 26.
What does welcome() call?
welcome() calls 1 function(s): setup.

Analyze Your Own Codebase

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

Try Supermodel Free