From e65606fd9de1cba18840dd08a37355d370617582 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Wed, 28 Feb 2018 18:11:13 +0100 Subject: [PATCH] Throttle track progress for better performance --- front/src/components/audio/Track.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/src/components/audio/Track.vue b/front/src/components/audio/Track.vue index ff177e624..e291dae78 100644 --- a/front/src/components/audio/Track.vue +++ b/front/src/components/audio/Track.vue @@ -19,7 +19,7 @@ import {mapState} from 'vuex' import url from '@/utils/url' import formats from '@/audio/formats' - +import _ from 'lodash' // import logger from '@/logging' export default { @@ -98,11 +98,11 @@ export default { } } }, - updateProgress: function () { + updateProgress: _.throttle(function () { if (this.$refs.audio) { this.$store.dispatch('player/updateProgress', this.$refs.audio.currentTime) } - }, + }, 1000), ended: function () { if (this.looping === 1) { this.setCurrentTime(0)