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

Function traverseTwoPhase

code/controlled-uncontrolled/public/app.js:1907–1920  ·  view source on GitHub ↗

* Simulates the traversal of a two-phase, capture/bubble event dispatch.

(inst, fn, arg)

Source from the content-addressed store, hash-verified

1905 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
1906 */
1907function traverseTwoPhase(inst, fn, arg) {
1908 var path = [];
1909 while (inst) {
1910 path.push(inst);
1911 inst = getParent(inst);
1912 }
1913 var i = void 0;
1914 for (i = path.length; i-- > 0;) {
1915 fn(path[i], 'captured', arg);
1916 }
1917 for (i = 0; i < path.length; i++) {
1918 fn(path[i], 'bubbled', arg);
1919 }
1920}
1921
1922/**
1923 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected