Home / File/ index.js — react Source File

index.js — react Source File

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

File javascript BabelCompiler Optimization 9 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071["index.js"]
  f4316f6a_6bd2_2c45_d5ba_4eca3b37ec0d["constants.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> f4316f6a_6bd2_2c45_d5ba_4eca3b37ec0d
  fd9d5c95_e738_dee5_e510_e7b1e9e4ea39["domEvents.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> fd9d5c95_e738_dee5_e510_e7b1e9e4ea39
  d4066e75_dcea_2912_73ff_88e30b9530d2["domEventSequences.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> d4066e75_dcea_2912_73ff_88e30b9530d2
  c03693b0_2482_9a7d_a058_7ba891e5839d["domEnvironment.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> c03693b0_2482_9a7d_a058_7ba891e5839d
  010da236_784b_cbe9_c79d_2a93e35a2880["hasPointerEvent"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> 010da236_784b_cbe9_c79d_2a93e35a2880
  fc292dc3_3a11_3f76_520e_fd7050406acc["setPointerEvent"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> fc292dc3_3a11_3f76_520e_fd7050406acc
  e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6["testHelpers.js"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> e8ddf5ea_829d_30ec_14cf_70bc1d21a7a6
  657afeb3_4a7c_6f61_d659_e1d95b512447["describeWithPointerEvent"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> 657afeb3_4a7c_6f61_d659_e1d95b512447
  c35f2872_1e4f_b3df_5b5d_c3d3ddfb69db["testWithPointerType"]
  cfa588b4_57a7_0b0e_ec6d_2d8b58107071 --> c35f2872_1e4f_b3df_5b5d_c3d3ddfb69db
  6a79b8db_8663_727d_cf8d_8ad55d807b11["index-test.internal.js"]
  6a79b8db_8663_727d_cf8d_8ad55d807b11 --> cfa588b4_57a7_0b0e_ec6d_2d8b58107071
  style cfa588b4_57a7_0b0e_ec6d_2d8b58107071 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.
 *
 * @emails react-core
 */

'use strict';

import {buttonType, buttonsType} from './constants';
import * as domEvents from './domEvents';
import * as domEventSequences from './domEventSequences';
import {hasPointerEvent, setPointerEvent, platform} from './domEnvironment';
import {describeWithPointerEvent, testWithPointerType} from './testHelpers';

const createEventTarget = node => ({
  node,
  /**
   * Simple events abstraction.
   */
  blur(payload) {
    node.dispatchEvent(domEvents.blur(payload));
    node.dispatchEvent(domEvents.focusOut(payload));
  },
  click(payload) {
    node.dispatchEvent(domEvents.click(payload));
  },
  focus(payload) {
    node.dispatchEvent(domEvents.focus(payload));
    node.dispatchEvent(domEvents.focusIn(payload));
    node.focus();
  },
  keydown(payload) {
    node.dispatchEvent(domEvents.keydown(payload));
  },
  keyup(payload) {
    node.dispatchEvent(domEvents.keyup(payload));
  },
  scroll(payload) {
    node.dispatchEvent(domEvents.scroll(payload));
  },
  virtualclick(payload) {
    node.dispatchEvent(domEvents.virtualclick(payload));
  },
  /**
   * PointerEvent abstraction.
   * Dispatches the expected sequence of PointerEvents, MouseEvents, and
   * TouchEvents for a given environment.
   */
  contextmenu(payload, options) {
    domEventSequences.contextmenu(node, payload, options);
  },
  // node no longer receives events for the pointer
  pointercancel(payload) {
    domEventSequences.pointercancel(node, payload);
  },
  // node dispatches down events
  pointerdown(payload) {
// ... (62 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.js do?
index.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in index.js?
index.js defines 1 function(s): createEventTarget.
What does index.js depend on?
index.js imports 9 module(s): constants.js, describeWithPointerEvent, domEnvironment.js, domEventSequences.js, domEvents.js, hasPointerEvent, setPointerEvent, testHelpers.js, and 1 more.
What files import index.js?
index.js is imported by 1 file(s): index-test.internal.js.
Where is index.js in the architecture?
index.js is located at packages/dom-event-testing-library/index.js (domain: BabelCompiler, subdomain: Optimization, directory: packages/dom-event-testing-library).

Analyze Your Own Codebase

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

Try Supermodel Free