aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/utils.ts')
-rw-r--r--client/src/assets/player/utils.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/client/src/assets/player/utils.ts b/client/src/assets/player/utils.ts
index 7a99dba1a..f5407ef60 100644
--- a/client/src/assets/player/utils.ts
+++ b/client/src/assets/player/utils.ts
@@ -36,6 +36,18 @@ function getStoredMute () {
36 return undefined 36 return undefined
37} 37}
38 38
39function getAverageBandwidth () {
40 const value = getLocalStorage('average-bandwidth')
41 if (value !== null && value !== undefined) {
42 const valueNumber = parseInt(value, 10)
43 if (isNaN(valueNumber)) return undefined
44
45 return valueNumber
46 }
47
48 return undefined
49}
50
39function saveVolumeInStore (value: number) { 51function saveVolumeInStore (value: number) {
40 return setLocalStorage('volume', value.toString()) 52 return setLocalStorage('volume', value.toString())
41} 53}
@@ -44,10 +56,16 @@ function saveMuteInStore (value: boolean) {
44 return setLocalStorage('mute', value.toString()) 56 return setLocalStorage('mute', value.toString())
45} 57}
46 58
59function saveAverageBandwidth (value: number) {
60 return setLocalStorage('average-bandwidth', value.toString())
61}
62
47export { 63export {
48 toTitleCase, 64 toTitleCase,
49 getStoredVolume, 65 getStoredVolume,
50 saveVolumeInStore, 66 saveVolumeInStore,
67 saveAverageBandwidth,
68 getAverageBandwidth,
51 saveMuteInStore, 69 saveMuteInStore,
52 getStoredMute, 70 getStoredMute,
53 bytes 71 bytes