Building Smart Intervals with Svelte 5

How to build an interval that automatically adapts its timing when your app state changes—no manual cleanup required.