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

Function trapCapturedEvent

code/one-direction-data-flow/public/app.js:5779–5788  ·  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

5777 * @internal
5778 */
5779function trapCapturedEvent(topLevelType, handlerBaseName, element) {
5780 if (!element) {
5781 return null;
5782 }
5783 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5784
5785 addEventCaptureListener(element, handlerBaseName,
5786 // Check if interactive and wrap in interactiveUpdates
5787 dispatch.bind(null, topLevelType));
5788}
5789
5790function dispatchInteractiveEvent(topLevelType, nativeEvent) {
5791 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected