play/pause button
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user