perf: make watch page use less RAM

This commit is contained in:
Kenny 2022-08-10 15:44:07 -04:00
parent 0760e1537b
commit 383e91cfe9
1 changed files with 3 additions and 8 deletions

View File

@ -22,20 +22,15 @@ export default {
humanDuration: 0,
}
},
methods: {
calcDuration() {
this.humanDuration = this.$vuetube.humanTime(this.duration);
}
},
mounted() {
//--- Only call 'calcDuration()' when 'this.duration' becomes defined ---//
//--- Only set video duration when 'this.duration' becomes defined ---//
const durationTimer = setInterval(() => {
if (this.duration) {
this.calcDuration();
this.humanDuration = this.$vuetube.humanTime(this.duration);
return clearInterval(durationTimer);
}
}, 100);
//--- END Only call 'calcDuration()' when 'this.duration' becomes defined ---//
//--- END Only set video duration when 'this.duration' becomes defined ---//
}
};
</script>