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

Function traverseTwoPhase

code/composition/public/app.js:2721–2734  ·  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

2719 * Simulates the traversal of a two-phase, capture/bubble event dispatch.
2720 */
2721function traverseTwoPhase(inst, fn, arg) {
2722 var path = [];
2723 while (inst) {
2724 path.push(inst);
2725 inst = getParent(inst);
2726 }
2727 var i = void 0;
2728 for (i = path.length; i-- > 0;) {
2729 fn(path[i], 'captured', arg);
2730 }
2731 for (i = 0; i < path.length; i++) {
2732 fn(path[i], 'bubbled', arg);
2733 }
2734}
2735
2736/**
2737 * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that

Calls 1

getParentFunction · 0.70

Tested by

no test coverage detected