MCPcopy Create free account
hub / github.com/Lucifier129/react-lite / isFallbackCompositionEnd

Function isFallbackCompositionEnd

examples/simple/react.js:221–238  ·  view source on GitHub ↗

* Does our fallback mode think that this event is the end of composition? * * @param {string} topLevelType * @param {object} nativeEvent * @return {boolean}

(topLevelType, nativeEvent)

Source from the content-addressed store, hash-verified

219 * @return {boolean}
220 */
221function isFallbackCompositionEnd(topLevelType, nativeEvent) {
222 switch (topLevelType) {
223 case topLevelTypes.topKeyUp:
224 // Command keys insert or clear IME input.
225 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
226 case topLevelTypes.topKeyDown:
227 // Expect IME keyCode on each keydown. If we get any other
228 // code we must have exited earlier.
229 return nativeEvent.keyCode !== START_KEYCODE;
230 case topLevelTypes.topKeyPress:
231 case topLevelTypes.topMouseDown:
232 case topLevelTypes.topBlur:
233 // Events are not possible without cancelling IME.
234 return true;
235 default:
236 return false;
237 }
238}
239
240/**
241 * Google Input Tools provides composition data via a CustomEvent,

Callers 2

extractCompositionEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected