(topLevelType, eventSystemFlags, container, nativeEvent)
| 7868 | } |
| 7869 | |
| 7870 | function dispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) { |
| 7871 | if (!_enabled) { |
| 7872 | return; |
| 7873 | } |
| 7874 | |
| 7875 | if (hasQueuedDiscreteEvents() && isReplayableDiscreteEvent(topLevelType)) { |
| 7876 | // If we already have a queue of discrete events, and this is another discrete |
| 7877 | // event, then we can't dispatch it regardless of its target, since they |
| 7878 | // need to dispatch in order. |
| 7879 | queueDiscreteEvent(null, // Flags that we're not actually blocked on anything as far as we know. |
| 7880 | topLevelType, eventSystemFlags, container, nativeEvent); |
| 7881 | return; |
| 7882 | } |
| 7883 | |
| 7884 | var blockedOn = attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent); |
| 7885 | |
| 7886 | if (blockedOn === null) { |
| 7887 | // We successfully dispatched this event. |
| 7888 | clearIfContinuousEvent(topLevelType, nativeEvent); |
| 7889 | return; |
| 7890 | } |
| 7891 | |
| 7892 | if (isReplayableDiscreteEvent(topLevelType)) { |
| 7893 | // This this to be replayed later once the target is available. |
| 7894 | queueDiscreteEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent); |
| 7895 | return; |
| 7896 | } |
| 7897 | |
| 7898 | if (queueIfContinuousEvent(blockedOn, topLevelType, eventSystemFlags, container, nativeEvent)) { |
| 7899 | return; |
| 7900 | } // We need to clear only if we didn't queue because |
| 7901 | // queueing is accummulative. |
| 7902 | |
| 7903 | |
| 7904 | clearIfContinuousEvent(topLevelType, nativeEvent); // This is not replayable so we'll invoke it but without a target, |
| 7905 | // in case the event system needs to trace it. |
| 7906 | |
| 7907 | { |
| 7908 | dispatchEventForLegacyPluginEventSystem(topLevelType, eventSystemFlags, nativeEvent, null); |
| 7909 | } |
| 7910 | } // Attempt dispatching an event. Returns a SuspenseInstance or Container if it's blocked. |
| 7911 | |
| 7912 | function attemptToDispatchEvent(topLevelType, eventSystemFlags, container, nativeEvent) { |
| 7913 | // TODO: Warn if _enabled is false. |
nothing calls this directly
no test coverage detected