Throttle track progress for better performance
This commit is contained in:
parent
bb1cfd56f9
commit
e65606fd9d
|
@ -19,7 +19,7 @@
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
import formats from '@/audio/formats'
|
import formats from '@/audio/formats'
|
||||||
|
import _ from 'lodash'
|
||||||
// import logger from '@/logging'
|
// import logger from '@/logging'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -98,11 +98,11 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateProgress: function () {
|
updateProgress: _.throttle(function () {
|
||||||
if (this.$refs.audio) {
|
if (this.$refs.audio) {
|
||||||
this.$store.dispatch('player/updateProgress', this.$refs.audio.currentTime)
|
this.$store.dispatch('player/updateProgress', this.$refs.audio.currentTime)
|
||||||
}
|
}
|
||||||
},
|
}, 1000),
|
||||||
ended: function () {
|
ended: function () {
|
||||||
if (this.looping === 1) {
|
if (this.looping === 1) {
|
||||||
this.setCurrentTime(0)
|
this.setCurrentTime(0)
|
||||||
|
|
Loading…
Reference in New Issue