refactor(queue): add history field and pushHistory helper

Inert in this commit — no callers yet. Sets up the back-stack used
by the upcoming history-aware prev rewrite.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.7 committed 2026-05-06 16:24:52 +08:00
1 parent 94c60ad465
commit c4b7cfaa2f
1 file changed
+10
+10
View File
@@ -21,6 +21,16 @@ export class PlayQueue {
private currentIndex = -1; private currentIndex = -1;
private mode: PlayMode = PlayMode.Sequential; private mode: PlayMode = PlayMode.Sequential;
private playedIndices = new Set<number>(); private playedIndices = new Set<number>();
private history: number[] = [];
private static readonly HISTORY_LIMIT = 50;
private pushHistory(idx: number): void {
if (idx < 0 || idx >= this.songs.length) return;
this.history.push(idx);
if (this.history.length > PlayQueue.HISTORY_LIMIT) {
this.history.shift();
}
}
add(song: QueuedSong): void { add(song: QueuedSong): void {
this.songs.push(song); this.songs.push(song);