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

Function trapBubbledEvent

code/one-direction-data-flow/public/app.js:5758–5767  ·  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

5756 * @internal
5757 */
5758function trapBubbledEvent(topLevelType, handlerBaseName, element) {
5759 if (!element) {
5760 return null;
5761 }
5762 var dispatch = isInteractiveTopLevelEventType(topLevelType) ? dispatchInteractiveEvent : dispatchEvent;
5763
5764 addEventBubbleListener(element, handlerBaseName,
5765 // Check if interactive and wrap in interactiveUpdates
5766 dispatch.bind(null, topLevelType));
5767}
5768
5769/**
5770 * 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