(topLevelType, nativeEvent)
| 6170 | } |
| 6171 | |
| 6172 | function dispatchEvent(topLevelType, nativeEvent) { |
| 6173 | if (!_enabled) { |
| 6174 | return; |
| 6175 | } |
| 6176 | |
| 6177 | var nativeEventTarget = getEventTarget(nativeEvent); |
| 6178 | var targetInst = getClosestInstanceFromNode(nativeEventTarget); |
| 6179 | if (targetInst !== null && typeof targetInst.tag === 'number' && !isFiberMounted(targetInst)) { |
| 6180 | // If we get an event (ex: img onload) before committing that |
| 6181 | // component's mount, ignore it for now (that is, treat it as if it was an |
| 6182 | // event on a non-React tree). We might also consider queueing events and |
| 6183 | // dispatching them after the mount. |
| 6184 | targetInst = null; |
| 6185 | } |
| 6186 | |
| 6187 | var bookKeeping = getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst); |
| 6188 | |
| 6189 | try { |
| 6190 | // Event queue being processed in the same cycle allows |
| 6191 | // `preventDefault`. |
| 6192 | batchedUpdates(handleTopLevel, bookKeeping); |
| 6193 | } finally { |
| 6194 | releaseTopLevelCallbackBookKeeping(bookKeeping); |
| 6195 | } |
| 6196 | } |
| 6197 | |
| 6198 | var ReactDOMEventListener = Object.freeze({ |
| 6199 | get _enabled () { return _enabled; }, |
nothing calls this directly
no test coverage detected