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

Function trapCapturedEvent

code/styling/public/app.js:5906–5915  ·  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

5904 * @internal
5905 */
5906function trapCapturedEvent(topLevelType, handlerBaseName, element) {
5907 if (!element) {
5908 return null;
5909 }
5910 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5911
5912 addEventCaptureListener(element, handlerBaseName,
5913 // Check if interactive and wrap in interactiveUpdates
5914 dispatch.bind(null, topLevelType));
5915}
5916
5917function dispatchInteractiveEvent(topLevelType, nativeEvent) {
5918 interactiveUpdates(dispatchEvent, topLevelType, nativeEvent);

Callers 1

listenToFunction · 0.70

Calls 1

addEventCaptureListenerFunction · 0.70

Tested by

no test coverage detected