MCPcopy Index your code
hub / github.com/microsoft/SandDance / dispatchEvent

Function dispatchEvent

docs/external/js/react-dom.development.js:4298–4338  ·  view source on GitHub ↗
(topLevelType, eventSystemFlags, container, nativeEvent)

Source from the content-addressed store, hash-verified

4296 }
4297
4298 function dispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
4299 if (!_enabled) {
4300 return;
4301 }
4302
4303 if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) {
4304 // If we already have a queue of discrete events, and this is another discrete
4305 // event, then we can't dispatch it regardless of its target, since they
4306 // need to dispatch in order.
4307 queueDiscreteEvent(null, // Flags that we're not actually blocked on anything as far as we know.
4308 topLevelType, eventSystemFlags, container, nativeEvent);
4309 return;
4310 }
4311
4312 var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent);
4313
4314 if (blockedOn === null) {
4315 // We successfully dispatched this event.
4316 clearIfContinuousEvent(topLevelType, nativeEvent);
4317 return;
4318 }
4319
4320 if (isReplayableDiscreteEvent(topLevelType)) {
4321 // This this to be replayed later once the target is available.
4322 queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent);
4323 return;
4324 }
4325
4326 if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent)) {
4327 return;
4328 } // We need to clear only if we didn't queue because
4329 // queueing is accummulative.
4330
4331
4332 clearIfContinuousEvent(topLevelType, nativeEvent); // This is not replayable so we'll invoke it but without a target,
4333 // in case the event system needs to trace it.
4334
4335 {
4336 dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null);
4337 }
4338 } // Attempt dispatching an event. Returns a SuspenseInstance or Container if it's blocked.
4339
4340 function attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) {
4341 // TODO: Warn if _enabled is false.

Callers

nothing calls this directly

Calls 7

hasQueuedDiscreteEventsFunction · 0.85
queueDiscreteEventFunction · 0.85
attemptToDispatchEventFunction · 0.85
clearIfContinuousEventFunction · 0.85
queueIfContinuousEventFunction · 0.85

Tested by

no test coverage detected