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

Function trapBubbledEvent

code/composition/public/app.js:6023–6032  ·  view source on GitHub ↗

* Traps top-level events by using event bubbling. * * @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 functio

(topLevelType, handlerBaseName, element)

Source from the content-addressed store, hash-verified

6021 * @internal
6022 */
6023function trapBubbledEvent(topLevelType, handlerBaseName, element) {
6024 if (!element) {
6025 return null;
6026 }
6027 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
6028
6029 addEventBubbleListener(element, handlerBaseName,
6030 // Check if interactive and wrap in interactiveUpdates
6031 dispatch.bind(null, topLevelType));
6032}
6033
6034/**
6035 * Traps a top-level event by using event capturing.

Callers 3

listenToFunction · 0.70
setInitialProperties$1Function · 0.70
diffHydratedProperties$1Function · 0.70

Calls 1

addEventBubbleListenerFunction · 0.70

Tested by

no test coverage detected