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

Function trapCapturedEvent

code/dependency-injection/public/app.js:5999–6008  ·  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

5997 * @internal
5998 */
5999function trapCapturedEvent(topLevelType, handlerBaseName, element) {
6000 if (!element) {
6001 return null;
6002 }
6003 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6004
6005 addEventCaptureListener(element, handlerBaseName,
6006 // Check if interactive and wrap in interactiveUpdates
6007 dispatch.bind(null, topLevelType));
6008}
6009
6010function dispatchInteractiveEvent(topLevelType, nativeEvent) {
6011 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected