Home / File/ EventPluginRegistry.js — react Source File

EventPluginRegistry.js — react Source File

Architecture documentation for EventPluginRegistry.js, a javascript file in the react codebase. 3 imports, 3 dependents.

File javascript BabelCompiler Validation 3 imports 3 dependents 5 functions

Entity Profile

Dependency Diagram

graph LR
  6b52f26d_d341_6500_ecb0_54a0747596f4["EventPluginRegistry.js"]
  b2f450b6_f67a_153d_5efb_a03735431450["ReactSyntheticEventType.js"]
  6b52f26d_d341_6500_ecb0_54a0747596f4 --> b2f450b6_f67a_153d_5efb_a03735431450
  e7f91ff9_eaf6_39c4_5463_6f4e0e1c075f["PluginModuleType.js"]
  6b52f26d_d341_6500_ecb0_54a0747596f4 --> e7f91ff9_eaf6_39c4_5463_6f4e0e1c075f
  304edd67_bb4f_7b82_bbee_3b770742ef97["TopLevelEventTypes.js"]
  6b52f26d_d341_6500_ecb0_54a0747596f4 --> 304edd67_bb4f_7b82_bbee_3b770742ef97
  846f0667_39ae_eb6e_55fe_26d3acf81e44["ReactFabricEventEmitter.js"]
  846f0667_39ae_eb6e_55fe_26d3acf81e44 --> 6b52f26d_d341_6500_ecb0_54a0747596f4
  baab5855_112a_37e6_6ca7_0813fd6ae027["ReactNativeEventEmitter.js"]
  baab5855_112a_37e6_6ca7_0813fd6ae027 --> 6b52f26d_d341_6500_ecb0_54a0747596f4
  f7a9d9bb_c840_a894_8211_44aed0d8bb24["ReactNativeInjectionShared.js"]
  f7a9d9bb_c840_a894_8211_44aed0d8bb24 --> 6b52f26d_d341_6500_ecb0_54a0747596f4
  style 6b52f26d_d341_6500_ecb0_54a0747596f4 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 {DispatchConfig} from './ReactSyntheticEventType';
import type {
  AnyNativeEvent,
  PluginName,
  LegacyPluginModule,
} from './PluginModuleType';
import type {TopLevelType} from './TopLevelEventTypes';

type NamesToPlugins = {
  [key: PluginName]: LegacyPluginModule<AnyNativeEvent>,
};
type EventPluginOrder = null | Array<PluginName>;

/**
 * Injectable ordering of event plugins.
 */
let eventPluginOrder: EventPluginOrder = null;

/**
 * Injectable mapping from names to event plugin modules.
 */
const namesToPlugins: NamesToPlugins = {};

/**
 * Recomputes the plugin list using the injected plugins and plugin ordering.
 *
 * @private
 */
function recomputePluginOrdering(): void {
  if (!eventPluginOrder) {
    // Wait until an `eventPluginOrder` is injected.
    return;
  }
  for (const pluginName in namesToPlugins) {
    const pluginModule = namesToPlugins[pluginName];
    // $FlowFixMe[incompatible-use] found when upgrading Flow
    const pluginIndex = eventPluginOrder.indexOf(pluginName);

    if (pluginIndex <= -1) {
      throw new Error(
        'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
          `the plugin ordering, \`${pluginName}\`.`,
      );
    }

    if (plugins[pluginIndex]) {
      continue;
    }

    if (!pluginModule.extractEvents) {
      throw new Error(
// ... (206 more lines)

Domain

Subdomains

Frequently Asked Questions

What does EventPluginRegistry.js do?
EventPluginRegistry.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 EventPluginRegistry.js?
EventPluginRegistry.js defines 5 function(s): injectEventPluginOrder, injectEventPluginsByName, publishEventForPlugin, publishRegistrationName, recomputePluginOrdering.
What does EventPluginRegistry.js depend on?
EventPluginRegistry.js imports 3 module(s): PluginModuleType.js, ReactSyntheticEventType.js, TopLevelEventTypes.js.
What files import EventPluginRegistry.js?
EventPluginRegistry.js is imported by 3 file(s): ReactFabricEventEmitter.js, ReactNativeEventEmitter.js, ReactNativeInjectionShared.js.
Where is EventPluginRegistry.js in the architecture?
EventPluginRegistry.js is located at packages/react-native-renderer/src/legacy-events/EventPluginRegistry.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