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

Function trapCapturedEvent

code/new-context-api/public/app.js:5267–5276  ·  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

5265 * @internal
5266 */
5267function trapCapturedEvent(topLevelType, handlerBaseName, element) {
5268 if (!element) {
5269 return null;
5270 }
5271 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5272
5273 addEventCaptureListener(element, handlerBaseName,
5274 // Check if interactive and wrap in interactiveUpdates
5275 dispatch.bind(null, topLevelType));
5276}
5277
5278function dispatchInteractiveEvent(topLevelType, nativeEvent) {
5279 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected