SyntheticEvent.js — react Source File
Architecture documentation for SyntheticEvent.js, a javascript file in the react codebase. 4 imports, 9 dependents.
Entity Profile
Dependency Diagram
graph LR 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606["SyntheticEvent.js"] d78b8333_1674_238a_05bc_00693b9f27d2["getEventCharCode.js"] 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 --> d78b8333_1674_238a_05bc_00693b9f27d2 e465f930_ff45_eb24_125c_d4942d1fa85f["getEventCharCode"] 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 --> e465f930_ff45_eb24_125c_d4942d1fa85f 42892443_e223_3da0_aeb9_e1b32a408fb0["ReactInternalTypes"] 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 --> 42892443_e223_3da0_aeb9_e1b32a408fb0 326b1b33_c1be_450b_f53b_51a78bbe8633["assign"] 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 --> 326b1b33_c1be_450b_f53b_51a78bbe8633 cfeccfd9_d509_de2e_b7f5_99190c395b57["ReactDOMEventHandle.js"] cfeccfd9_d509_de2e_b7f5_99190c395b57 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 d908643f_a970_7fa5_64a4_010ab47f44ac["ReactDOMEventHandleTypes.js"] d908643f_a970_7fa5_64a4_010ab47f44ac --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 a235366c_1abe_162c_b9bf_7fbbfb597584["BeforeInputEventPlugin.js"] a235366c_1abe_162c_b9bf_7fbbfb597584 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7["ChangeEventPlugin.js"] ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 5c7e27b3_eb27_811d_04b8_b882f63e7494["EnterLeaveEventPlugin.js"] 5c7e27b3_eb27_811d_04b8_b882f63e7494 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 fa31fc00_cb0d_ab89_d37c_e55788d531b6["FormActionEventPlugin.js"] fa31fc00_cb0d_ab89_d37c_e55788d531b6 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 f81462d0_b06e_fbf9_f1b8_93352f59d5eb["ScrollEndEventPlugin.js"] f81462d0_b06e_fbf9_f1b8_93352f59d5eb --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 b8a5c95d_02fb_4719_0efd_4463f2546996["SelectEventPlugin.js"] b8a5c95d_02fb_4719_0efd_4463f2546996 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 43bccccc_6fb9_1e3f_9c97_ea90d6d01475["SimpleEventPlugin.js"] 43bccccc_6fb9_1e3f_9c97_ea90d6d01475 --> 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 style 9c3d71d9_41af_c5e7_cd35_d25bbf6cf606 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
*/
/* eslint valid-typeof: 0 */
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
import assign from 'shared/assign';
import getEventCharCode from './getEventCharCode';
type EventInterfaceType = {
[propName: string]: 0 | ((event: {[propName: string]: mixed, ...}) => mixed),
};
function functionThatReturnsTrue() {
return true;
}
function functionThatReturnsFalse() {
return false;
}
// This is intentionally a factory so that we have different returned constructors.
// If we had a single constructor, it would be megamorphic and engines would deopt.
function createSyntheticEvent(Interface: EventInterfaceType) {
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*/
// $FlowFixMe[missing-this-annot]
function SyntheticBaseEvent(
reactName: string | null,
reactEventType: string,
targetInst: Fiber | null,
nativeEvent: {[propName: string]: mixed, ...},
nativeEventTarget: null | EventTarget,
) {
this._reactName = reactName;
this._targetInst = targetInst;
this.type = reactEventType;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = null;
for (const propName in Interface) {
// ... (555 more lines)
Domain
Subdomains
Functions
- ClipboardEventInterface.clipboardData()
- EventInterfaceType.movementX()
- EventInterfaceType.movementY()
- EventInterfaceType.relatedTarget()
- EventInterfaceType.timeStamp()
- KeyboardEventInterface.charCode()
- KeyboardEventInterface.keyCode()
- KeyboardEventInterface.which()
- createSyntheticEvent()
- functionThatReturnsFalse()
- functionThatReturnsTrue()
- getEventKey()
- getEventModifierState()
- modifierStateGetter()
- updateMouseMovementPolyfillState()
Dependencies
- ReactInternalTypes
- assign
- getEventCharCode
- getEventCharCode.js
Imported By
- packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js
- packages/react-dom-bindings/src/events/plugins/ChangeEventPlugin.js
- packages/react-dom-bindings/src/events/plugins/EnterLeaveEventPlugin.js
- packages/react-dom-bindings/src/events/plugins/FormActionEventPlugin.js
- packages/react-dom-bindings/src/client/ReactDOMEventHandle.js
- packages/react-dom-bindings/src/client/ReactDOMEventHandleTypes.js
- packages/react-dom-bindings/src/events/plugins/ScrollEndEventPlugin.js
- packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js
- packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js
Source
Frequently Asked Questions
What does SyntheticEvent.js do?
SyntheticEvent.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 SyntheticEvent.js?
SyntheticEvent.js defines 15 function(s): ClipboardEventInterface.clipboardData, EventInterfaceType.movementX, EventInterfaceType.movementY, EventInterfaceType.relatedTarget, EventInterfaceType.timeStamp, KeyboardEventInterface.charCode, KeyboardEventInterface.keyCode, KeyboardEventInterface.which, createSyntheticEvent, functionThatReturnsFalse, and 5 more.
What does SyntheticEvent.js depend on?
SyntheticEvent.js imports 4 module(s): ReactInternalTypes, assign, getEventCharCode, getEventCharCode.js.
What files import SyntheticEvent.js?
SyntheticEvent.js is imported by 9 file(s): BeforeInputEventPlugin.js, ChangeEventPlugin.js, EnterLeaveEventPlugin.js, FormActionEventPlugin.js, ReactDOMEventHandle.js, ReactDOMEventHandleTypes.js, ScrollEndEventPlugin.js, SelectEventPlugin.js, and 1 more.
Where is SyntheticEvent.js in the architecture?
SyntheticEvent.js is located at packages/react-dom-bindings/src/events/SyntheticEvent.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