Home / Function/ accumulateTwoPhaseListeners() — react Function Reference

accumulateTwoPhaseListeners() — react Function Reference

Architecture documentation for the accumulateTwoPhaseListeners() function in DOMPluginEventSystem.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  dd9eb6ac_296c_ca63_51dd_da82f645aaaa["accumulateTwoPhaseListeners()"]
  816b54e5_c63c_f8b2_68e8_0c637e281f03["DOMPluginEventSystem.js"]
  dd9eb6ac_296c_ca63_51dd_da82f645aaaa -->|defined in| 816b54e5_c63c_f8b2_68e8_0c637e281f03
  86643861_8bb8_470a_be1c_fd6ca6b189a3["extractCompositionEvent()"]
  86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa
  f9de52ad_6a52_511a_a2cc_a210ea41b984["extractBeforeInputEvent()"]
  f9de52ad_6a52_511a_a2cc_a210ea41b984 -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa
  e54786af_acd3_355e_7471_27ed34df6c6d["createAndAccumulateChangeEvent()"]
  e54786af_acd3_355e_7471_27ed34df6c6d -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa
  8f15f580_96e9_b161_b714_742b0ed77fe8["manualDispatchScrollEndEvent()"]
  8f15f580_96e9_b161_b714_742b0ed77fe8 -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa
  4c50b416_304e_a759_8f8d_e22e46f2d54d["constructSelectEvent()"]
  4c50b416_304e_a759_8f8d_e22e46f2d54d -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa
  dc523599_fdf9_701c_242d_51dc12a7153c["getListener()"]
  dd9eb6ac_296c_ca63_51dd_da82f645aaaa -->|calls| dc523599_fdf9_701c_242d_51dc12a7153c
  f83d0a32_5c24_8096_449b_8e278ad03f9d["createDispatchListener()"]
  dd9eb6ac_296c_ca63_51dd_da82f645aaaa -->|calls| f83d0a32_5c24_8096_449b_8e278ad03f9d
  style dd9eb6ac_296c_ca63_51dd_da82f645aaaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/events/DOMPluginEventSystem.js lines 834–870

export function accumulateTwoPhaseListeners(
  targetFiber: Fiber | null,
  reactName: string,
): Array<DispatchListener> {
  const captureName = reactName + 'Capture';
  const listeners: Array<DispatchListener> = [];
  let instance = targetFiber;

  // Accumulate all instances and listeners via the target -> root path.
  while (instance !== null) {
    const {stateNode, tag} = instance;
    // Handle listeners that are on HostComponents (i.e. <div>)
    if (
      (tag === HostComponent ||
        tag === HostHoistable ||
        tag === HostSingleton) &&
      stateNode !== null
    ) {
      const currentTarget = stateNode;
      const captureListener = getListener(instance, captureName);
      if (captureListener != null) {
        listeners.unshift(
          createDispatchListener(instance, captureListener, currentTarget),
        );
      }
      const bubbleListener = getListener(instance, reactName);
      if (bubbleListener != null) {
        listeners.push(
          createDispatchListener(instance, bubbleListener, currentTarget),
        );
      }
    }
    if (instance.tag === HostRoot) {
      return listeners;
    }
    instance = instance.return;
  }

Domain

Subdomains

Frequently Asked Questions

What does accumulateTwoPhaseListeners() do?
accumulateTwoPhaseListeners() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/DOMPluginEventSystem.js.
Where is accumulateTwoPhaseListeners() defined?
accumulateTwoPhaseListeners() is defined in packages/react-dom-bindings/src/events/DOMPluginEventSystem.js at line 834.
What does accumulateTwoPhaseListeners() call?
accumulateTwoPhaseListeners() calls 2 function(s): createDispatchListener, getListener.
What calls accumulateTwoPhaseListeners()?
accumulateTwoPhaseListeners() is called by 5 function(s): constructSelectEvent, createAndAccumulateChangeEvent, extractBeforeInputEvent, extractCompositionEvent, manualDispatchScrollEndEvent.

Analyze Your Own Codebase

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

Try Supermodel Free