Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nuxt): loading indicator enhancement #25119

Merged
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8afee84
feat: enchance loading indicator strategy
Jan 9, 2024
e989ea4
fix: cancel requestAnimationFrame on clear
Jan 9, 2024
de87b58
docs: update NuxtLoadingIndicator documentary
Jan 9, 2024
601d118
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 9, 2024
952fdce
docs: Update documentation accordingly changes
Jan 10, 2024
c4b4253
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 10, 2024
a5f41a2
docs: update documentation
Jan 10, 2024
9ea2a6c
refactor: remove custom timing function property and change that on t…
Jan 11, 2024
dd25108
docs: update documentation accordingly refactoring
Jan 11, 2024
b0ecdb0
docs: fix example
Jan 11, 2024
be699be
docs: fix linter errors
Jan 11, 2024
290438c
fix: remove extra line
Jan 11, 2024
a240809
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 12, 2024
e70c48f
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 19, 2024
14fc476
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 21, 2024
e4fd870
Merge branch 'main' into feat/loading-indicator-enhancement
danielroe Jan 21, 2024
a46ef58
Merge branch 'main' into feat/loading-indicator-enhancement
ivan-kalachikov Jan 25, 2024
87b54f6
refactor: small perf/typo/style fixes
danielroe Jan 29, 2024
85a07c0
Merge remote-tracking branch 'origin/main' into feat/loading-indicato…
danielroe Jan 29, 2024
16d2ebd
refactor: allow providing custom `estimatedProgress` function
danielroe Jan 29, 2024
6666615
docs: update docs
danielroe Jan 29, 2024
4e052d2
docs: update remaining reference
danielroe Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: cancel requestAnimationFrame on clear
  • Loading branch information
Ivan Kalachikov committed Jan 9, 2024
commit e989ea4a63abb0a7d07ba5b46ef6935c6e689930
6 changes: 4 additions & 2 deletions packages/nuxt/src/app/composables/loading-indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
const progress = ref(0)
const isLoading = ref(false)
const done = ref(false)
const rafId = ref(0)

let _throttle: any = null

Expand Down Expand Up @@ -79,6 +80,7 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {

function clear () {
clearTimeout(_throttle)
cancelAnimationFrame(rafId.value)
_throttle = null
}

Expand All @@ -96,12 +98,12 @@ function createLoadingIndicator (opts: Partial<LoadingIndicatorOpts> = {}) {
? progressTimingFunction(duration, elapsed)
:_defaultProgressTimingFunction(duration, elapsed)
_setProgressValue(progress, value)
requestAnimationFrame(step)
rafId.value = requestAnimationFrame(step)
}
}

if (import.meta.client) {
requestAnimationFrame(step)
rafId.value = requestAnimationFrame(step)
}
}

Expand Down
Loading