Home / File/ EventPluginUtils.js — react Source File

EventPluginUtils.js — react Source File

Architecture documentation for EventPluginUtils.js, a javascript file in the react codebase. 2 imports, 5 dependents.

File javascript BabelCompiler Validation 2 imports 5 dependents 9 functions

Entity Profile

Dependency Diagram

graph LR
  c47175ea_4123_c4e5_c30d_de7506f00f3a["EventPluginUtils.js"]
  af78c51d_c7cb_3bf4_550f_f3fcc48f4f34["isArray"]
  c47175ea_4123_c4e5_c30d_de7506f00f3a --> af78c51d_c7cb_3bf4_550f_f3fcc48f4f34
  9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e["ReactCurrentFiber"]
  c47175ea_4123_c4e5_c30d_de7506f00f3a --> 9a7dedff_ebb2_a1a9_a4c3_be4ea69f001e
  f5f93cbf_f7fc_49fc_c1ef_17ea4ef34d0e["ReactFabricInjection.js"]
  f5f93cbf_f7fc_49fc_c1ef_17ea4ef34d0e --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93["ReactNativeGetListener.js"]
  5f61475e_65e9_53ee_1eeb_f357a8fb2b93 --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  dea78bbd_0d4e_27e7_3d5e_51bbb5d31b87["ReactNativeInjection.js"]
  dea78bbd_0d4e_27e7_3d5e_51bbb5d31b87 --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  501868ac_ed82_decd_b0b4_e77c7390f910["EventBatching.js"]
  501868ac_ed82_decd_b0b4_e77c7390f910 --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  674c6180_b91e_e17d_fb2d_40a6a3631bb3["ResponderEventPlugin.js"]
  674c6180_b91e_e17d_fb2d_40a6a3631bb3 --> c47175ea_4123_c4e5_c30d_de7506f00f3a
  style c47175ea_4123_c4e5_c30d_de7506f00f3a 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.
 */

import isArray from 'shared/isArray';

import {runWithFiberInDEV} from 'react-reconciler/src/ReactCurrentFiber';

let hasError = false;
let caughtError = null;

export let getFiberCurrentPropsFromNode = null;
export let getInstanceFromNode = null;
export let getNodeFromInstance = null;

export function setComponentTree(
  getFiberCurrentPropsFromNodeImpl,
  getInstanceFromNodeImpl,
  getNodeFromInstanceImpl,
) {
  getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
  getInstanceFromNode = getInstanceFromNodeImpl;
  getNodeFromInstance = getNodeFromInstanceImpl;
  if (__DEV__) {
    if (!getNodeFromInstance || !getInstanceFromNode) {
      console.error(
        'Injected ' +
          'module is missing getNodeFromInstance or getInstanceFromNode.',
      );
    }
  }
}

function validateEventDispatches(event) {
  if (__DEV__) {
    const dispatchListeners = event._dispatchListeners;
    const dispatchInstances = event._dispatchInstances;

    const listenersIsArr = isArray(dispatchListeners);
    const listenersLen = listenersIsArr
      ? dispatchListeners.length
      : dispatchListeners
        ? 1
        : 0;

    const instancesIsArr = isArray(dispatchInstances);
    const instancesLen = instancesIsArr
      ? dispatchInstances.length
      : dispatchInstances
        ? 1
        : 0;

    if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
      console.error('EventPluginUtils: Invalid `event`.');
    }
  }
}
// ... (146 more lines)

Domain

Subdomains

Dependencies

  • ReactCurrentFiber
  • isArray

Frequently Asked Questions

What does EventPluginUtils.js do?
EventPluginUtils.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 EventPluginUtils.js?
EventPluginUtils.js defines 9 function(s): executeDirectDispatch, executeDispatch, executeDispatchesInOrder, executeDispatchesInOrderStopAtTrue, executeDispatchesInOrderStopAtTrueImpl, hasDispatches, rethrowCaughtError, setComponentTree, validateEventDispatches.
What does EventPluginUtils.js depend on?
EventPluginUtils.js imports 2 module(s): ReactCurrentFiber, isArray.
What files import EventPluginUtils.js?
EventPluginUtils.js is imported by 5 file(s): EventBatching.js, ReactFabricInjection.js, ReactNativeGetListener.js, ReactNativeInjection.js, ResponderEventPlugin.js.
Where is EventPluginUtils.js in the architecture?
EventPluginUtils.js is located at packages/react-native-renderer/src/legacy-events/EventPluginUtils.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-native-renderer/src/legacy-events).

Analyze Your Own Codebase

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

Try Supermodel Free