perf: ⚡ move init loops to player store
This commit is contained in:
parent
3aa5a6020e
commit
668c377c33
@ -33,15 +33,9 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init()
|
this.init()
|
||||||
setInterval(this.loop, 40000)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(usePlayer, ['init', 'time']),
|
...mapActions(usePlayer, ['init']),
|
||||||
loop() {
|
|
||||||
if (this.paused === false) {
|
|
||||||
this.time()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -33,9 +33,15 @@ export const usePlayer = defineStore('player', {
|
|||||||
audio.ontimeupdate = () => (this.currentTime = audio.currentTime)
|
audio.ontimeupdate = () => (this.currentTime = audio.currentTime)
|
||||||
audio.onvolumechange = () => (this.volume = audio.volume)
|
audio.onvolumechange = () => (this.volume = audio.volume)
|
||||||
|
|
||||||
setInterval(this.loop, 1000)
|
setInterval(this.act, 40000)
|
||||||
|
setInterval(this.conflict, 1000)
|
||||||
},
|
},
|
||||||
loop() {
|
act() {
|
||||||
|
if (this.paused === false) {
|
||||||
|
this.time()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
conflict() {
|
||||||
this.playCount = 0
|
this.playCount = 0
|
||||||
},
|
},
|
||||||
async load(episode: EpisodeInterface | null, podcastUrl?: string) {
|
async load(episode: EpisodeInterface | null, podcastUrl?: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user