Clear wire statistics update interval on unmount
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jack Hadrill 2021-01-06 04:40:40 +00:00
parent 734e791045
commit 8561b9c6c6
2 changed files with 10 additions and 2 deletions

View File

@ -59,6 +59,7 @@ export default {
const toast = useToast()
const trackers = inject('trackers')
var webTorrent = null
var wireUpdateHandle = null
const player = ref(null)
const video = reactive({
file: null,
@ -85,6 +86,9 @@ export default {
if (webTorrent) {
webTorrent.destroy()
}
if (wireUpdateHandle) {
clearInterval(wireUpdateHandle)
}
})
const onFilesSelected = (f) => {
@ -123,7 +127,7 @@ export default {
toast.add({ severity: 'info', summary: 'New watcher', detail: 'Someone has joined your screen.', life: 3000 })
})
setInterval(() => {
wireUpdateHandle = setInterval(() => {
updateWireStatistics()
}, 200)

View File

@ -65,6 +65,7 @@ export default {
const toast = useToast()
const trackers = inject('trackers')
var webTorrent = null
var wireUpdateHandle = null
const player = ref(null)
const progress = ref()
const video = reactive({
@ -100,6 +101,9 @@ export default {
if (webTorrent) {
webTorrent.destroy()
}
if (wireUpdateHandle) {
clearInterval(wireUpdateHandle)
}
})
const downloadVideo = (infoHash) => {
@ -146,7 +150,7 @@ export default {
file.renderTo(player.value)
setInterval(() => {
wireUpdateHandle = setInterval(() => {
updateWireStatistics()
}, 200)
}