Change wire statistics update interval

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

View File

@ -117,14 +117,16 @@ export default {
torrent.on('upload', bytes => {
state.uploaded += bytes
updateWireStatistics()
})
torrent.on('wire', wire => {
updateWireStatistics()
toast.add({ severity: 'info', summary: 'New watcher', detail: 'Someone has joined your screen.', life: 3000 })
})
setInterval(() => {
updateWireStatistics()
}, 200)
toast.add({ severity: 'success', summary: 'Video added', detail: `You are now sharing ${video.name}`, life: 5000 })
})
}

View File

@ -105,7 +105,6 @@ export default {
const downloadVideo = (infoHash) => {
webTorrent.add(infoHash, { announce: trackers }, torrent => {
torrent.on('wire', () => {
updateWireStatistics()
toast.add({ severity: 'info', summary: 'New watcher', detail: 'Someone has joined your screen.', life: 3000 })
})
@ -114,7 +113,6 @@ export default {
})
torrent.on('upload', bytes => {
updateWireStatistics()
})
torrent.on('download', bytes => {
@ -124,7 +122,6 @@ export default {
}
state.downloaded += bytes
progress.value = state.downloaded / video.size * 100
updateWireStatistics()
})
})
}
@ -148,6 +145,10 @@ export default {
})
file.renderTo(player.value)
setInterval(() => {
updateWireStatistics()
}, 200)
}
const updateWireStatistics = () => {