mirror of https://github.com/VueTubeApp/VueTube
perf: ⚡ make watch page use less RAM
This commit is contained in:
parent
0760e1537b
commit
383e91cfe9
|
@ -22,20 +22,15 @@ export default {
|
||||||
humanDuration: 0,
|
humanDuration: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
calcDuration() {
|
|
||||||
this.humanDuration = this.$vuetube.humanTime(this.duration);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
mounted() {
|
||||||
//--- Only call 'calcDuration()' when 'this.duration' becomes defined ---//
|
//--- Only set video duration when 'this.duration' becomes defined ---//
|
||||||
const durationTimer = setInterval(() => {
|
const durationTimer = setInterval(() => {
|
||||||
if (this.duration) {
|
if (this.duration) {
|
||||||
this.calcDuration();
|
this.humanDuration = this.$vuetube.humanTime(this.duration);
|
||||||
return clearInterval(durationTimer);
|
return clearInterval(durationTimer);
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
//--- END Only call 'calcDuration()' when 'this.duration' becomes defined ---//
|
//--- END Only set video duration when 'this.duration' becomes defined ---//
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue