gatherActiveObservationsAtDepth.js 764 B

12345678910111213141516171819
  1. import { resizeObservers } from '../utils/resizeObservers';
  2. import { calculateDepthForNode } from './calculateDepthForNode';
  3. var gatherActiveObservationsAtDepth = function (depth) {
  4. resizeObservers.forEach(function processObserver(ro) {
  5. ro.activeTargets.splice(0, ro.activeTargets.length);
  6. ro.skippedTargets.splice(0, ro.skippedTargets.length);
  7. ro.observationTargets.forEach(function processTarget(ot) {
  8. if (ot.isActive()) {
  9. if (calculateDepthForNode(ot.target) > depth) {
  10. ro.activeTargets.push(ot);
  11. }
  12. else {
  13. ro.skippedTargets.push(ot);
  14. }
  15. }
  16. });
  17. });
  18. };
  19. export { gatherActiveObservationsAtDepth };