play/pause button

This commit is contained in:
simon
2026-08-12 18:02:01 +02:00
parent b846146992
commit 049a269885
6 changed files with 126 additions and 4 deletions
+8
View File
@@ -136,6 +136,14 @@ const handlers = {
commit();
},
// Broadcast without saving: `paused` is not part of the persisted state.
setPaused(_ws, msg) {
if (typeof msg.paused !== 'boolean') return;
if (store.getState().paused === msg.paused) return;
store.getState().paused = msg.paused;
broadcastState();
},
setBackground(_ws, msg) {
if (!store.isBackground(msg.key)) return;
store.getState().background = msg.key;
+3
View File
@@ -23,6 +23,9 @@ const state = {
currentId: null,
background: DEFAULT_BACKGROUND,
animation: DEFAULT_ANIMATION,
// Deliberately absent from save(): a restart should bring the music back,
// not leave the party silently paused because of a click hours ago.
paused: false,
};
export function getState() {