mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 20:49:04 +01:00
feat(player): persist volume in local storage
This commit is contained in:
parent
174decf8da
commit
baedced83f
@ -37,6 +37,11 @@ export default {
|
|||||||
return this.value
|
return this.value
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
|
try {
|
||||||
|
localStorage.setItem("volume", val);
|
||||||
|
} catch(error) {
|
||||||
|
console.error('Failed to store volume', err)
|
||||||
|
}
|
||||||
this.$emit('input', val)
|
this.$emit('input', val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -141,6 +146,10 @@ export default {
|
|||||||
if (this.value === 0) {
|
if (this.value === 0) {
|
||||||
this.isMute = true
|
this.isMute = true
|
||||||
}
|
}
|
||||||
|
const storageVolume = localStorage.getItem("volume")
|
||||||
|
if (storageVolume) {
|
||||||
|
this.volume = parseFloat(storageVolume)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.removeEventListener('mousewheel', this.scroll)
|
window.removeEventListener('mousewheel', this.scroll)
|
||||||
|
Loading…
Reference in New Issue
Block a user