| 796 | /** Mark that a scroll event just happened. Background intervals gate on |
| 797 | * getIsScrollDraining() and skip their work until the debounce clears. */ |
| 798 | export function markScrollActivity(): void { |
| 799 | scrollDraining = true |
| 800 | if (scrollDrainTimer) clearTimeout(scrollDrainTimer) |
| 801 | scrollDrainTimer = setTimeout(() => { |
| 802 | scrollDraining = false |
| 803 | scrollDrainTimer = undefined |
| 804 | }, SCROLL_DRAIN_IDLE_MS) |
| 805 | scrollDrainTimer.unref?.() |
| 806 | } |
| 807 | |
| 808 | /** True while scroll is actively draining (within 150ms of last event). |
| 809 | * Intervals should early-return when this is set — the work picks up next |