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

Function traverseTwoPhase

code/higher-order-components/public/app.js:2577–2590  ·  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

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

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected