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

Function traverseTwoPhase

code/dependency-injection/public/app.js:2676–2689  ·  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

2674 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
2675 */
2676function traverseTwoPhase(inst, fn, arg) {
2677 var path = [];
2678 while (inst) {
2679 path.push(inst);
2680 inst = getParent(inst);
2681 }
2682 var i = void 0;
2683 for (i = path.length; i-- > 0;) {
2684 fn(path[i], 'captured', arg);
2685 }
2686 for (i = 0; i < path.length; i++) {
2687 fn(path[i], 'bubbled', arg);
2688 }
2689}
2690
2691/**
2692 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected