Home / Function/ simulateEventDispatch() — react Function Reference

simulateEventDispatch() — react Function Reference

Architecture documentation for the simulateEventDispatch() function in simulateBrowserEventDispatch.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  29e8c263_e7be_59f5_e84a_a168f126b528["simulateEventDispatch()"]
  25f70bd8_f112_d04a_4a3f_6a33aba6b460["simulateBrowserEventDispatch.js"]
  29e8c263_e7be_59f5_e84a_a168f126b528 -->|defined in| 25f70bd8_f112_d04a_4a3f_6a33aba6b460
  style 29e8c263_e7be_59f5_e84a_a168f126b528 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/internal-test-utils/simulateBrowserEventDispatch.js lines 43–60

async function simulateEventDispatch(eventImpl) {
  if (eventImpl._dispatchFlag || !eventImpl._initializedFlag) {
    throw DOMException.create(this._globalObject, [
      'Tried to dispatch an uninitialized event',
      'InvalidStateError',
    ]);
  }
  if (eventImpl.eventPhase !== EVENT_PHASE.NONE) {
    throw DOMException.create(this._globalObject, [
      'Tried to dispatch a dispatching event',
      'InvalidStateError',
    ]);
  }

  eventImpl.isTrusted = false;

  await _dispatch.call(this, eventImpl);
}

Domain

Subdomains

Frequently Asked Questions

What does simulateEventDispatch() do?
simulateEventDispatch() is a function in the react codebase, defined in packages/internal-test-utils/simulateBrowserEventDispatch.js.
Where is simulateEventDispatch() defined?
simulateEventDispatch() is defined in packages/internal-test-utils/simulateBrowserEventDispatch.js at line 43.

Analyze Your Own Codebase

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

Try Supermodel Free