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

Function traverseTwoPhase

code/styling/public/app.js:2583–2596  ·  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

2581 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
2582 */
2583function traverseTwoPhase(inst, fn, arg) {
2584 var path = [];
2585 while (inst) {
2586 path.push(inst);
2587 inst = getParent(inst);
2588 }
2589 var i = void 0;
2590 for (i = path.length; i-- > 0;) {
2591 fn(path[i], 'captured', arg);
2592 }
2593 for (i = 0; i < path.length; i++) {
2594 fn(path[i], 'bubbled', arg);
2595 }
2596}
2597
2598/**
2599 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected