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

Function dispatchEvent

code/composition/public/app.js:6059–6083  ·  view source on GitHub ↗
(topLevelType, nativeEvent)

Source from the content-addressed store, hash-verified

6057}
6058
6059function dispatchEvent(topLevelType, nativeEvent) {
6060 if (!_enabled) {
6061 return;
6062 }
6063
6064 var nativeEventTarget = getEventTarget(nativeEvent);
6065 var targetInst = getClosestInstanceFromNode(nativeEventTarget);
6066 if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) {
6067 // If we get an event (ex: img onload) before committing that
6068 // component's mount, ignore it for now (that is, treat it as if it was an
6069 // event on a non-React tree). We might also consider queueing events and
6070 // dispatching them after the mount.
6071 targetInst = null;
6072 }
6073
6074 var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst);
6075
6076 try {
6077 // Event queue being processed in the same cycle allows
6078 // `preventDefault`.
6079 batchedUpdates(handleTopLevel, bookKeeping);
6080 } finally {
6081 releaseTopLevelCallbackBookKeeping(bookKeeping);
6082 }
6083}
6084
6085var ReactDOMEventListener = Object.freeze({
6086 get _enabled () { return _enabled; },

Callers

nothing calls this directly

Calls 6

getEventTargetFunction · 0.70
isFiberMountedFunction · 0.70
batchedUpdatesFunction · 0.70

Tested by

no test coverage detected