ai-code-battle/web/src/components/pip-registry.ts
jedarden 75672f6a92 feat(web): add ambient activity awareness per §16.18
Favicon badge with numeric counter, tab title updates when backgrounded,
haptic pulse on mobile for key events, seasonal background color shift,
and 30s polling for new match/evolution activity.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 17:06:02 -04:00

24 lines
663 B
TypeScript

// Lightweight registry that bridges the replay page and the router.
// The replay page registers its active viewer; the router checks before navigating away.
export interface ActiveReplay {
matchId: string;
canvas: HTMLCanvasElement;
canvasWrapper: HTMLElement;
getScoreText: () => string;
getTurn: () => number;
getTotalTurns: () => number;
getIsPlaying: () => boolean;
togglePlay: () => void;
pause: () => void;
}
let activeReplay: ActiveReplay | null = null;
export function setActiveReplay(replay: ActiveReplay | null): void {
activeReplay = replay;
}
export function getActiveReplay(): ActiveReplay | null {
return activeReplay;
}