extractCompositionEvent() — react Function Reference
Architecture documentation for the extractCompositionEvent() function in BeforeInputEventPlugin.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 86643861_8bb8_470a_be1c_fd6ca6b189a3["extractCompositionEvent()"] a235366c_1abe_162c_b9bf_7fbbfb597584["BeforeInputEventPlugin.js"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|defined in| a235366c_1abe_162c_b9bf_7fbbfb597584 28a876ba_5723_6438_1f13_a75a6758eb3f["extractEvents()"] 28a876ba_5723_6438_1f13_a75a6758eb3f -->|calls| 86643861_8bb8_470a_be1c_fd6ca6b189a3 4b89f1f5_3fb4_e82c_d792_08ee5b70f544["getCompositionEventType()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| 4b89f1f5_3fb4_e82c_d792_08ee5b70f544 b1ccaf73_becb_d293_5763_65d2ed08a1be["isFallbackCompositionStart()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| b1ccaf73_becb_d293_5763_65d2ed08a1be 3274186b_0da8_a8fa_b931_f27f1fec9378["isFallbackCompositionEnd()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| 3274186b_0da8_a8fa_b931_f27f1fec9378 0fd7518f_d4c4_2db7_7d85_4049fa5c45d5["isUsingKoreanIME()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| 0fd7518f_d4c4_2db7_7d85_4049fa5c45d5 dd9eb6ac_296c_ca63_51dd_da82f645aaaa["accumulateTwoPhaseListeners()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| dd9eb6ac_296c_ca63_51dd_da82f645aaaa 7b0dfa25_61f3_d05d_f416_c1f977953bf8["getDataFromCustomEvent()"] 86643861_8bb8_470a_be1c_fd6ca6b189a3 -->|calls| 7b0dfa25_61f3_d05d_f416_c1f977953bf8 style 86643861_8bb8_470a_be1c_fd6ca6b189a3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js lines 194–253
function extractCompositionEvent(
dispatchQueue: DispatchQueue,
domEventName: DOMEventName,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: null | EventTarget,
) {
let eventType;
let fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(domEventName);
} else if (!isComposing) {
if (isFallbackCompositionStart(domEventName, nativeEvent)) {
eventType = 'onCompositionStart';
}
} else if (isFallbackCompositionEnd(domEventName, nativeEvent)) {
eventType = 'onCompositionEnd';
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!isComposing && eventType === 'onCompositionStart') {
isComposing = FallbackCompositionStateInitialize(nativeEventTarget);
} else if (eventType === 'onCompositionEnd') {
if (isComposing) {
fallbackData = FallbackCompositionStateGetData();
}
}
}
const listeners = accumulateTwoPhaseListeners(targetInst, eventType);
if (listeners.length > 0) {
const event: ReactSyntheticEvent = new SyntheticCompositionEvent(
eventType,
domEventName,
null,
nativeEvent,
nativeEventTarget,
);
dispatchQueue.push({event, listeners});
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
// $FlowFixMe[incompatible-use]
event.data = fallbackData;
} else {
const customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
// $FlowFixMe[incompatible-use]
event.data = customData;
}
}
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does extractCompositionEvent() do?
extractCompositionEvent() is a function in the react codebase, defined in packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js.
Where is extractCompositionEvent() defined?
extractCompositionEvent() is defined in packages/react-dom-bindings/src/events/plugins/BeforeInputEventPlugin.js at line 194.
What does extractCompositionEvent() call?
extractCompositionEvent() calls 6 function(s): accumulateTwoPhaseListeners, getCompositionEventType, getDataFromCustomEvent, isFallbackCompositionEnd, isFallbackCompositionStart, isUsingKoreanIME.
What calls extractCompositionEvent()?
extractCompositionEvent() is called by 1 function(s): extractEvents.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free