hello world, again

This commit is contained in:
taskylizard 2024-08-07 12:23:35 +00:00
commit f479740dd1
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
133 changed files with 32895 additions and 0 deletions

View file

@ -0,0 +1,23 @@
import nprogress, { type NProgress } from 'nprogress'
import type { EnhanceAppContext } from 'vitepress'
export function loadProgress(router: EnhanceAppContext['router']): NProgress {
if (typeof window === 'undefined') return
setTimeout(() => {
nprogress.configure({ showSpinner: false })
const cacheBeforeRouteChange = router.onBeforeRouteChange
const cacheAfterRouteChange = router.onAfterRouteChanged
router.onBeforeRouteChange = (to) => {
nprogress.start()
cacheBeforeRouteChange?.(to)
}
router.onAfterRouteChanged = (to) => {
nprogress.done()
cacheAfterRouteChange?.(to)
}
})
return nprogress
}