Intersection Observer & Efficient Scroll Handling

What is the best way to handle scroll-based progress indicators?
const progressObserver = new IntersectionObserver((entries) => {
  entries.forEach(entry => {
    const progress = Math.round(entry.intersectionRatio * 100);
    updateProgressBar(progress);
  });
}, {
  threshold: Array.from({ length: 101 }, (_, i) => i / 100)
});

progressObserver.observe(document.querySelector('article'));
Next Question (12/20)