Merge pull request #974 from Zibbp/master

Persist Volume in Local Storage
This commit is contained in:
advplyr 2022-09-08 16:51:05 -05:00 committed by GitHub
commit 1ec12a547e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,11 @@ export default {
return this.value
},
set(val) {
try {
localStorage.setItem("volume", val);
} catch(error) {
console.error('Failed to store volume', err)
}
this.$emit('input', val)
}
},
@ -141,6 +146,10 @@ export default {
if (this.value === 0) {
this.isMute = true
}
const storageVolume = localStorage.getItem("volume")
if (storageVolume) {
this.volume = parseFloat(storageVolume)
}
},
beforeDestroy() {
window.removeEventListener('mousewheel', this.scroll)