| 812 | /** Mark that a scroll event just happened. Background intervals gate on |
| 813 | * getIsScrollDraining() and skip their work until the debounce clears. */ |
| 814 | export function markScrollActivity(): void { |
| 815 | scrollDraining = true |
| 816 | if (scrollDrainTimer) clearTimeout(scrollDrainTimer) |
| 817 | scrollDrainTimer = setTimeout(() => { |
| 818 | scrollDraining = false |
| 819 | scrollDrainTimer = undefined |
| 820 | }, SCROLL_DRAIN_IDLE_MS) |
| 821 | scrollDrainTimer.unref?.() |
| 822 | } |
| 823 | |
| 824 | /** True while scroll is actively draining (within 150ms of last event). |
| 825 | * Intervals should early-return when this is set — the work picks up next |