Home / File/ EventRegistry.js — react Source File

EventRegistry.js — react Source File

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

File javascript BabelCompiler Validation 2 imports 9 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  e1c602b7_5988_fa00_bb9f_269d66d38107["EventRegistry.js"]
  4e9925e9_ca97_8d79_6ffa_a9347d262615["DOMEventNames.js"]
  e1c602b7_5988_fa00_bb9f_269d66d38107 --> 4e9925e9_ca97_8d79_6ffa_a9347d262615
  8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"]
  e1c602b7_5988_fa00_bb9f_269d66d38107 --> 8344de1b_978c_be0f_eebd_38ccc4962a93
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b --> e1c602b7_5988_fa00_bb9f_269d66d38107
  cfeccfd9_d509_de2e_b7f5_99190c395b57["ReactDOMEventHandle.js"]
  cfeccfd9_d509_de2e_b7f5_99190c395b57 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  658d2068_647d_6a17_8bb9_0fcce1aac5fc["DOMEventProperties.js"]
  658d2068_647d_6a17_8bb9_0fcce1aac5fc --> e1c602b7_5988_fa00_bb9f_269d66d38107
  816b54e5_c63c_f8b2_68e8_0c637e281f03["DOMPluginEventSystem.js"]
  816b54e5_c63c_f8b2_68e8_0c637e281f03 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  a235366c_1abe_162c_b9bf_7fbbfb597584["BeforeInputEventPlugin.js"]
  a235366c_1abe_162c_b9bf_7fbbfb597584 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7["ChangeEventPlugin.js"]
  ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  5c7e27b3_eb27_811d_04b8_b882f63e7494["EnterLeaveEventPlugin.js"]
  5c7e27b3_eb27_811d_04b8_b882f63e7494 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  f81462d0_b06e_fbf9_f1b8_93352f59d5eb["ScrollEndEventPlugin.js"]
  f81462d0_b06e_fbf9_f1b8_93352f59d5eb --> e1c602b7_5988_fa00_bb9f_269d66d38107
  b8a5c95d_02fb_4719_0efd_4463f2546996["SelectEventPlugin.js"]
  b8a5c95d_02fb_4719_0efd_4463f2546996 --> e1c602b7_5988_fa00_bb9f_269d66d38107
  style e1c602b7_5988_fa00_bb9f_269d66d38107 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 {DOMEventName} from './DOMEventNames';

import {enableCreateEventHandleAPI} from 'shared/ReactFeatureFlags';

export const allNativeEvents: Set<DOMEventName> = new Set();

if (enableCreateEventHandleAPI) {
  allNativeEvents.add('beforeblur');
  allNativeEvents.add('afterblur');
}

/**
 * Mapping from registration name to event name
 */
export const registrationNameDependencies: {
  [registrationName: string]: Array<DOMEventName>,
} = {};

/**
 * Mapping from lowercase registration names to the properly cased version,
 * used to warn in the case of missing event handlers. Available
 * only in __DEV__.
 * @type {Object}
 */
export const possibleRegistrationNames: {
  [lowerCasedName: string]: string,
} = __DEV__ ? {} : (null: any);
// Trust the developer to only use possibleRegistrationNames in __DEV__

export function registerTwoPhaseEvent(
  registrationName: string,
  dependencies: Array<DOMEventName>,
): void {
  registerDirectEvent(registrationName, dependencies);
  registerDirectEvent(registrationName + 'Capture', dependencies);
}

export function registerDirectEvent(
  registrationName: string,
  dependencies: Array<DOMEventName>,
) {
  if (__DEV__) {
    if (registrationNameDependencies[registrationName]) {
      console.error(
        'EventRegistry: More than one plugin attempted to publish the same ' +
          'registration name, `%s`.',
        registrationName,
      );
    }
  }

  registrationNameDependencies[registrationName] = dependencies;

  if (__DEV__) {
    const lowerCasedName = registrationName.toLowerCase();
    possibleRegistrationNames[lowerCasedName] = registrationName;

    if (registrationName === 'onDoubleClick') {
      possibleRegistrationNames.ondblclick = registrationName;
    }
  }

  for (let i = 0; i < dependencies.length; i++) {
    allNativeEvents.add(dependencies[i]);
  }
}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does EventRegistry.js do?
EventRegistry.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 EventRegistry.js?
EventRegistry.js defines 2 function(s): registerDirectEvent, registerTwoPhaseEvent.
What does EventRegistry.js depend on?
EventRegistry.js imports 2 module(s): DOMEventNames.js, ReactFeatureFlags.
What files import EventRegistry.js?
EventRegistry.js is imported by 9 file(s): BeforeInputEventPlugin.js, ChangeEventPlugin.js, DOMEventProperties.js, DOMPluginEventSystem.js, EnterLeaveEventPlugin.js, ReactDOMComponent.js, ReactDOMEventHandle.js, ScrollEndEventPlugin.js, and 1 more.
Where is EventRegistry.js in the architecture?
EventRegistry.js is located at packages/react-dom-bindings/src/events/EventRegistry.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/events).

Analyze Your Own Codebase

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

Try Supermodel Free