MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / trapCapturedEvent

Function trapCapturedEvent

code/third-party/public/app.js:5139–5148  ·  view source on GitHub ↗

* Traps a top-level event by using event capturing. * * @param {string} topLevelType Record from `BrowserEventConstants`. * @param {string} handlerBaseName Event name (e.g. "click"). * @param {object} element Element on which to attach listener. * @return {?object} An object with a remove funct

(topLevelType, handlerBaseName, element)

Source from the content-addressed store, hash-verified

5137 * @internal
5138 */
5139function trapCapturedEvent(topLevelType, handlerBaseName, element) {
5140 if (!element) {
5141 return null;
5142 }
5143 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5144
5145 addEventCaptureListener(element, handlerBaseName,
5146 // Check if interactive and wrap in interactiveUpdates
5147 dispatch.bind(null, topLevelType));
5148}
5149
5150function dispatchInteractiveEvent(topLevelType, nativeEvent) {
5151 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected