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

Function trapCapturedEvent

code/controlled-uncontrolled/public/app.js:5230–5239  ·  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

5228 * @internal
5229 */
5230function trapCapturedEvent(topLevelType, handlerBaseName, element) {
5231 if (!element) {
5232 return null;
5233 }
5234 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5235
5236 addEventCaptureListener(element, handlerBaseName,
5237 // Check if interactive and wrap in interactiveUpdates
5238 dispatch.bind(null, topLevelType));
5239}
5240
5241function dispatchInteractiveEvent(topLevelType, nativeEvent) {
5242 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected