import { type Accessor, createSignal, onCleanup } from "solid-js"; /** * Shared animation clock — a signal that ticks at a fixed interval. * * Components that need time-derived values (spinner frame, shimmer position, * stalled detection) should share a single clock rather than each running * their own setInterval. This mirrors CC's single useAnimationFrame(50) * and means animation automatically stops producing signal updates when * the component is disposed. */ export function useClock(intervalMs = 50): Accessor { const [time, setTime] = createSignal(0); const id = setInterval(() => setTime((t) => t + intervalMs), intervalMs); onCleanup(() => clearInterval(id)); return time; }