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

Function traverseTwoPhase

code/communication/public/app.js:2618–2631  ·  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

2616 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
2617 */
2618function traverseTwoPhase(inst, fn, arg) {
2619 var path = [];
2620 while (inst) {
2621 path.push(inst);
2622 inst = getParent(inst);
2623 }
2624 var i = void 0;
2625 for (i = path.length; i-- > 0;) {
2626 fn(path[i], 'captured', arg);
2627 }
2628 for (i = 0; i < path.length; i++) {
2629 fn(path[i], 'bubbled', arg);
2630 }
2631}
2632
2633/**
2634 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected