(topLevelType, nativeEvent)
| 5954 | } |
| 5955 | |
| 5956 | function dispatchEvent(topLevelType, nativeEvent) { |
| 5957 | if (!_enabled) { |
| 5958 | return; |
| 5959 | } |
| 5960 | |
| 5961 | var nativeEventTarget = getEventTarget(nativeEvent); |
| 5962 | var targetInst = getClosestInstanceFromNode(nativeEventTarget); |
| 5963 | if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { |
| 5964 | // If we get an event (ex: img onload) before committing that |
| 5965 | // component's mount, ignore it for now (that is, treat it as if it was an |
| 5966 | // event on a non-React tree). We might also consider queueing events and |
| 5967 | // dispatching them after the mount. |
| 5968 | targetInst = null; |
| 5969 | } |
| 5970 | |
| 5971 | var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); |
| 5972 | |
| 5973 | try { |
| 5974 | // Event queue being processed in the same cycle allows |
| 5975 | // `preventDefault`. |
| 5976 | batchedUpdates(handleTopLevel, bookKeeping); |
| 5977 | } finally { |
| 5978 | releaseTopLevelCallbackBookKeeping(bookKeeping); |
| 5979 | } |
| 5980 | } |
| 5981 | |
| 5982 | var ReactDOMEventListener = Object.freeze({ |
| 5983 | get _enabled () { return _enabled; }, |
nothing calls this directly
no test coverage detected