extractEvents() — react Function Reference
Architecture documentation for the extractEvents() function in SimpleEventPlugin.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD d0287fd0_244e_8562_5b35_de5bd863db97["extractEvents()"] 43bccccc_6fb9_1e3f_9c97_ea90d6d01475["SimpleEventPlugin.js"] d0287fd0_244e_8562_5b35_de5bd863db97 -->|defined in| 43bccccc_6fb9_1e3f_9c97_ea90d6d01475 e68ee20d_0906_0494_d1c4_4f9c91467ead["extractEvents()"] d0287fd0_244e_8562_5b35_de5bd863db97 -->|calls| e68ee20d_0906_0494_d1c4_4f9c91467ead e465f930_ff45_eb24_125c_d4942d1fa85f["getEventCharCode()"] d0287fd0_244e_8562_5b35_de5bd863db97 -->|calls| e465f930_ff45_eb24_125c_d4942d1fa85f ffe5dadd_1136_563b_f11c_19f1898c60be["accumulateSinglePhaseListeners()"] d0287fd0_244e_8562_5b35_de5bd863db97 -->|calls| ffe5dadd_1136_563b_f11c_19f1898c60be style d0287fd0_244e_8562_5b35_de5bd863db97 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js lines 57–235
function extractEvents(
dispatchQueue: DispatchQueue,
domEventName: DOMEventName,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: null | EventTarget,
eventSystemFlags: EventSystemFlags,
targetContainer: EventTarget,
): void {
const reactName = topLevelEventsToReactNames.get(domEventName);
if (reactName === undefined) {
return;
}
let SyntheticEventCtor = SyntheticEvent;
let reactEventType: string = domEventName;
switch (domEventName) {
case 'keypress':
// Firefox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
// TODO: Fixed in https://bugzilla.mozilla.org/show_bug.cgi?id=968056. Can
// probably remove.
if (getEventCharCode(((nativeEvent: any): KeyboardEvent)) === 0) {
return;
}
/* falls through */
case 'keydown':
case 'keyup':
SyntheticEventCtor = SyntheticKeyboardEvent;
break;
case 'focusin':
reactEventType = 'focus';
SyntheticEventCtor = SyntheticFocusEvent;
break;
case 'focusout':
reactEventType = 'blur';
SyntheticEventCtor = SyntheticFocusEvent;
break;
case 'beforeblur':
case 'afterblur':
SyntheticEventCtor = SyntheticFocusEvent;
break;
case 'click':
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
// TODO: Fixed in https://phabricator.services.mozilla.com/D26793. Can
// probably remove.
if (nativeEvent.button === 2) {
return;
}
/* falls through */
case 'auxclick':
case 'dblclick':
case 'mousedown':
case 'mousemove':
case 'mouseup':
// TODO: Disabled elements should not respond to mouse events
/* falls through */
case 'mouseout':
case 'mouseover':
case 'contextmenu':
SyntheticEventCtor = SyntheticMouseEvent;
break;
case 'drag':
case 'dragend':
case 'dragenter':
case 'dragexit':
case 'dragleave':
case 'dragover':
case 'dragstart':
case 'drop':
SyntheticEventCtor = SyntheticDragEvent;
break;
case 'touchcancel':
case 'touchend':
case 'touchmove':
case 'touchstart':
SyntheticEventCtor = SyntheticTouchEvent;
break;
case ANIMATION_END:
case ANIMATION_ITERATION:
Domain
Subdomains
Source
Frequently Asked Questions
What does extractEvents() do?
extractEvents() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js.
Where is extractEvents() defined?
extractEvents() is defined in packages/react-dom-bindings/src/events/plugins/SimpleEventPlugin.js at line 57.
What does extractEvents() call?
extractEvents() calls 3 function(s): accumulateSinglePhaseListeners, extractEvents, getEventCharCode.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free