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

Function traverseTwoPhase

code/redux/public/app.js:2834–2847  ·  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

2832 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
2833 */
2834function traverseTwoPhase(inst, fn, arg) {
2835 var path = [];
2836 while (inst) {
2837 path.push(inst);
2838 inst = getParent(inst);
2839 }
2840 var i = void 0;
2841 for (i = path.length; i-- > 0;) {
2842 fn(path[i], 'captured', arg);
2843 }
2844 for (i = 0; i < path.length; i++) {
2845 fn(path[i], 'bubbled', arg);
2846 }
2847}
2848
2849/**
2850 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected