(topLevelType, nativeEvent)
| 5152 | } |
| 5153 | |
| 5154 | function dispatchEvent(topLevelType, nativeEvent) { |
| 5155 | if (!_enabled) { |
| 5156 | return; |
| 5157 | } |
| 5158 | |
| 5159 | var nativeEventTarget = getEventTarget(nativeEvent); |
| 5160 | var targetInst = getClosestInstanceFromNode(nativeEventTarget); |
| 5161 | if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { |
| 5162 | // If we get an event (ex: img onload) before committing that |
| 5163 | // component's mount, ignore it for now (that is, treat it as if it was an |
| 5164 | // event on a non-React tree). We might also consider queueing events and |
| 5165 | // dispatching them after the mount. |
| 5166 | targetInst = null; |
| 5167 | } |
| 5168 | |
| 5169 | var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); |
| 5170 | |
| 5171 | try { |
| 5172 | // Event queue being processed in the same cycle allows |
| 5173 | // `preventDefault`. |
| 5174 | batchedUpdates(handleTopLevel, bookKeeping); |
| 5175 | } finally { |
| 5176 | releaseTopLevelCallbackBookKeeping(bookKeeping); |
| 5177 | } |
| 5178 | } |
| 5179 | |
| 5180 | var ReactDOMEventListener = Object.freeze({ |
| 5181 | get _enabled () { return _enabled; }, |
nothing calls this directly
no test coverage detected