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

Function traverseTwoPhase

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

1942 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
1943 */
1944function traverseTwoPhase(inst, fn, arg) {
1945 var path = [];
1946 while (inst) {
1947 path.push(inst);
1948 inst = getParent(inst);
1949 }
1950 var i = void 0;
1951 for (i = path.length; i-- > 0;) {
1952 fn(path[i], 'captured', arg);
1953 }
1954 for (i = 0; i < path.length; i++) {
1955 fn(path[i], 'bubbled', arg);
1956 }
1957}
1958
1959/**
1960 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected