src/js/plugins/i-sticky/i-sticky.js
function updateScrollPos() {
    if (!stickies.length) {
      return
    }

    lastKnownScrollTop =
      document.documentElement.scrollTop || document.body.scrollTop

    // Only trigger a layout change if we’re not already waiting for one
    if (!isAnimationRequested) {
      isAnimationRequested = true

      // Don’t update until next animation frame if we can, otherwise use a
      // timeout - either will help avoid too many repaints
      if (requestAnimationFrame) {
        requestAnimationFrame(setPositions)
      } else {
        if (timeout) {
          clearTimeout(timeout)
        }

        timeout = setTimeout(setPositions, 15)
      }
    }
  }
function updateScrollPos() {
    if (!stickies.length) {
      return
    }

    lastKnownScrollTop =
      document.documentElement.scrollTop || document.body.scrollTop

    // Only trigger a layout change if we’re not already waiting for one
    if (!isAnimationRequested) {
      isAnimationRequested = true

      // Don’t update until next animation frame if we can, otherwise use a
      // timeout - either will help avoid too many repaints
      if (requestAnimationFrame) {
        requestAnimationFrame(setPositions)
      } else {
        if (timeout) {
          clearTimeout(timeout)
        }

        timeout = setTimeout(setPositions, 15)
      }
    }
  }
Debounced scroll handling