mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-01 18:07:22 +00:00
fix(nuxt): only request animation frame on client (#25569)
This commit is contained in:
parent
2364aabe93
commit
10f2356ab4
@ -79,7 +79,9 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
|||||||
|
|
||||||
function clear () {
|
function clear () {
|
||||||
clearTimeout(_throttle)
|
clearTimeout(_throttle)
|
||||||
cancelAnimationFrame(rafId)
|
if (import.meta.client) {
|
||||||
|
cancelAnimationFrame(rafId)
|
||||||
|
}
|
||||||
_throttle = null
|
_throttle = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +95,9 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
|
|||||||
startTimeStamp ??= timeStamp
|
startTimeStamp ??= timeStamp
|
||||||
const elapsed = timeStamp - startTimeStamp
|
const elapsed = timeStamp - startTimeStamp
|
||||||
progress.value = Math.max(0, Math.min(100, getProgress(duration, elapsed)))
|
progress.value = Math.max(0, Math.min(100, getProgress(duration, elapsed)))
|
||||||
rafId = requestAnimationFrame(step)
|
if (import.meta.client) {
|
||||||
|
rafId = requestAnimationFrame(step)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (import.meta.client) {
|
if (import.meta.client) {
|
||||||
|
Loading…
Reference in New Issue
Block a user