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