Optimize when destroyed

This commit is contained in:
dragongoose 2023-04-10 20:55:53 -04:00
parent 10c94c4c24
commit 9ebf319211
Signed by: dragongoose
GPG key ID: 50DB99B921579009
2 changed files with 8 additions and 1 deletions

View file

@ -22,7 +22,7 @@ export default {
const protocol = import.meta.env.VITE_HTTPS === 'true' ? 'https://' : 'http://' const protocol = import.meta.env.VITE_HTTPS === 'true' ? 'https://' : 'http://'
const badgesFetch = await fetch(`${protocol}${import.meta.env.VITE_BACKEND_DOMAIN}/api/badges?channelName=${props.channelName}`) const badgesFetch = await fetch(`${protocol}${import.meta.env.VITE_BACKEND_DOMAIN}/api/badges?channelName=${props.channelName}`)
let badges: Badge[] = await badgesFetch.json() let badges: Badge[] = (await badgesFetch.json()).data
return { return {
ws: new WebSocket(`ws://${import.meta.env.VITE_BACKEND_DOMAIN}`), ws: new WebSocket(`ws://${import.meta.env.VITE_BACKEND_DOMAIN}`),
@ -75,6 +75,10 @@ export default {
}, },
components: { components: {
BadgeVue BadgeVue
},
unmounted() {
this.messages = []
this.badges = []
} }
} }
</script> </script>

View file

@ -34,6 +34,9 @@ export default {
this.player = videojs('video-player', this.options, () => { this.player = videojs('video-player', this.options, () => {
createQualitySelector(this.player) createQualitySelector(this.player)
}) })
},
unmounted() {
this.player.dispose()
} }
} }
</script> </script>