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>
24 lines
663 B
TypeScript
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;
|
|
}
|