Home / File/ fallbackEvalContext.js — react Source File

fallbackEvalContext.js — react Source File

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

Entity Profile

Dependency Diagram

graph LR
  0f44cdf4_7331_0b75_974c_8ca0e100ac64["fallbackEvalContext.js"]
  3ed4f770_e0fe_be1b_53aa_15b5121435ea["evalScripts.js"]
  0f44cdf4_7331_0b75_974c_8ca0e100ac64 --> 3ed4f770_e0fe_be1b_53aa_15b5121435ea
  style 0f44cdf4_7331_0b75_974c_8ca0e100ac64 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 {evalScripts} from '../evalScripts';

window.addEventListener('message', event => {
  if (event.data?.source === 'react-devtools-content-script-eval') {
    const {scriptId, args, requestId} = event.data.payload;
    const response = {result: null, error: null};
    try {
      if (!evalScripts[scriptId]) {
        throw new Error(`No eval script with id "${scriptId}" exists.`);
      }
      response.result = evalScripts[scriptId].fn.apply(null, args);
    } catch (err) {
      response.error = err.message;
    }
    window.postMessage(
      {
        source: 'react-devtools-content-script-eval-response',
        payload: {
          requestId,
          response,
        },
      },
      '*',
    );
  }
});

Domain

Dependencies

Frequently Asked Questions

What does fallbackEvalContext.js do?
fallbackEvalContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain.
What does fallbackEvalContext.js depend on?
fallbackEvalContext.js imports 1 module(s): evalScripts.js.
Where is fallbackEvalContext.js in the architecture?
fallbackEvalContext.js is located at packages/react-devtools-extensions/src/contentScripts/fallbackEvalContext.js (domain: BabelCompiler, 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