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

Function traverseTwoPhase

code/third-party/public/app.js:1816–1829  ·  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

1814 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
1815 */
1816function traverseTwoPhase(inst, fn, arg) {
1817 var path = [];
1818 while (inst) {
1819 path.push(inst);
1820 inst = getParent(inst);
1821 }
1822 var i = void 0;
1823 for (i = path.length; i-- > 0;) {
1824 fn(path[i], 'captured', arg);
1825 }
1826 for (i = 0; i < path.length; i++) {
1827 fn(path[i], 'bubbled', arg);
1828 }
1829}
1830
1831/**
1832 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected