add subscribers for player repeat and shuffle

This commit is contained in:
jeffvli
2025-11-05 19:44:30 -08:00
parent 6ced14d0e8
commit 7cd012de70
2 changed files with 42 additions and 1 deletions
+22
View File
@@ -1245,6 +1245,28 @@ export const subscribePlayerSpeed = (
);
};
export const subscribePlayerRepeat = (
onChange: (properties: { repeat: PlayerRepeat }, prev: { repeat: PlayerRepeat }) => void,
) => {
return usePlayerStoreBase.subscribe(
(state) => state.player.repeat,
(repeat, prevRepeat) => {
onChange({ repeat }, { repeat: prevRepeat });
},
);
};
export const subscribePlayerShuffle = (
onChange: (properties: { shuffle: PlayerShuffle }, prev: { shuffle: PlayerShuffle }) => void,
) => {
return usePlayerStoreBase.subscribe(
(state) => state.player.shuffle,
(shuffle, prevShuffle) => {
onChange({ shuffle }, { shuffle: prevShuffle });
},
);
};
export const usePlayerProperties = () => {
return usePlayerStoreBase(
useShallow((state) => ({