kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
feat: skip css updates if progress hasn't changed
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2346>environments/review-docs-nginx-aqlin2/deployments/17397
rodzic
bbe2375f6b
commit
8ce20c5621
|
@ -167,12 +167,20 @@ export const usePlayer = createGlobalState(() => {
|
|||
}, 1000)
|
||||
|
||||
// Progress
|
||||
let lastProgress = 0
|
||||
useRafFn(() => {
|
||||
const sound = currentSound.value
|
||||
document.documentElement.style.setProperty('--fw-track-progress', sound
|
||||
? `${(sound.currentTime / sound.duration * 100).toFixed(Math.log(window.innerWidth))}%`
|
||||
: '0'
|
||||
)
|
||||
const progress = sound
|
||||
? +(sound.currentTime / sound.duration * 100).toFixed(Math.log(window.innerWidth))
|
||||
: 0
|
||||
|
||||
if (progress !== lastProgress) {
|
||||
lastProgress = !isNaN(progress)
|
||||
? progress
|
||||
: 0
|
||||
|
||||
document.documentElement.style.setProperty('--fw-track-progress', `${lastProgress}%`)
|
||||
}
|
||||
})
|
||||
|
||||
// Loading
|
||||
|
|
Ładowanie…
Reference in New Issue