Throttle track progress for better performance

This commit is contained in:
Eliot Berriot 2018-02-28 18:11:13 +01:00
parent bb1cfd56f9
commit e65606fd9d
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
1 changed files with 3 additions and 3 deletions

View File

@ -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)