MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / extractBeforeInputEvent

Function extractBeforeInputEvent

code/composition/public/app.js:3590–3610  ·  view source on GitHub ↗

* Extract a SyntheticInputEvent for `beforeInput`, based on either native * `textInput` or fallback behavior. * * @return {?object} A SyntheticInputEvent.

(topLevelType, targetInst, nativeEvent, nativeEventTarget)

Source from the content-addressed store, hash-verified

3588 * @return {?object} A SyntheticInputEvent.
3589 */
3590function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
3591 var chars = void 0;
3592
3593 if (canUseTextInputEvent) {
3594 chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
3595 } else {
3596 chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
3597 }
3598
3599 // If no characters are being inserted, no BeforeInput event should
3600 // be fired.
3601 if (!chars) {
3602 return null;
3603 }
3604
3605 var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
3606
3607 event.data = chars;
3608 accumulateTwoPhaseDispatches(event);
3609 return event;
3610}
3611
3612/**
3613 * Create an `onBeforeInput` event to match

Callers 1

app.jsFile · 0.70

Calls 3

Tested by

no test coverage detected