Home / File/ SyntheticEvent.js — react Source File

SyntheticEvent.js — react Source File

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

File javascript BabelCompiler Validation 1 imports 2 dependents 9 functions

Entity Profile

Dependency Diagram

graph LR
  a47c9419_7313_73d9_a24c_401cd8fd59b8["SyntheticEvent.js"]
  326b1b33_c1be_450b_f53b_51a78bbe8633["assign"]
  a47c9419_7313_73d9_a24c_401cd8fd59b8 --> 326b1b33_c1be_450b_f53b_51a78bbe8633
  577670f6_1f7f_5e0d_b9b6_894b69a76a73["ReactNativeBridgeEventPlugin.js"]
  577670f6_1f7f_5e0d_b9b6_894b69a76a73 --> a47c9419_7313_73d9_a24c_401cd8fd59b8
  6212e25f_b3a3_8466_a790_e9a77ad55bf9["ResponderSyntheticEvent.js"]
  6212e25f_b3a3_8466_a790_e9a77ad55bf9 --> a47c9419_7313_73d9_a24c_401cd8fd59b8
  style a47c9419_7313_73d9_a24c_401cd8fd59b8 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.
 */

/* eslint valid-typeof: 0 */

import assign from 'shared/assign';

const EVENT_POOL_SIZE = 10;

/**
 * @interface Event
 * @see http://www.w3.org/TR/DOM-Level-3-Events/
 */
const EventInterface = {
  type: null,
  target: null,
  // currentTarget is set when dispatching; no use in copying it here
  currentTarget: function () {
    return null;
  },
  eventPhase: null,
  bubbles: null,
  cancelable: null,
  timeStamp: function (event) {
    return event.timeStamp || Date.now();
  },
  defaultPrevented: null,
  isTrusted: null,
};

function functionThatReturnsTrue() {
  return true;
}

function functionThatReturnsFalse() {
  return false;
}

/**
 * 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.
 *
 * @param {object} dispatchConfig Configuration used to dispatch this event.
 * @param {*} targetInst Marker identifying the event target.
 * @param {object} nativeEvent Native browser event.
 * @param {DOMEventTarget} nativeEventTarget Target node.
 */
// ... (288 more lines)

Domain

Subdomains

Dependencies

  • assign

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 9 function(s): EventInterface.currentTarget, EventInterface.timeStamp, SyntheticEvent, addEventPoolingTo, createOrGetPooledEvent, functionThatReturnsFalse, functionThatReturnsTrue, getPooledWarningPropertyDefinition, releasePooledEvent.
What does SyntheticEvent.js depend on?
SyntheticEvent.js imports 1 module(s): assign.
What files import SyntheticEvent.js?
SyntheticEvent.js is imported by 2 file(s): ReactNativeBridgeEventPlugin.js, ResponderSyntheticEvent.js.
Where is SyntheticEvent.js in the architecture?
SyntheticEvent.js is located at packages/react-native-renderer/src/legacy-events/SyntheticEvent.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