Throttle track progress for better performance

merge-requests/154/head
Eliot Berriot 2018-02-28 18:11:13 +01:00
rodzic bb1cfd56f9
commit e65606fd9d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

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