// Pure event-bus module separate from VideoIndexProvider.tsx so the // provider file only exports a Component + a `use*` hook — that's the // shape Next.js Fast Refresh requires to swap a Provider in place // instead of forcing a full page reload. const REFRESH_EVENT = "pinkudex:video-status-refresh"; export function dispatchVideoStatusRefresh() { if (typeof window === "undefined") return; window.dispatchEvent(new CustomEvent(REFRESH_EVENT)); } export function subscribeVideoStatusRefresh(cb: () => void): () => void { window.addEventListener(REFRESH_EVENT, cb); return () => window.removeEventListener(REFRESH_EVENT, cb); }