/
githubmirror
/
docusaurus
Обзор
Документация
Войти
/
githubmirror
/
docusaurus
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/docusaurus-theme-classic/src/nprogress.ts
32 строки
813 B
Markshawn
chore: fix CSS import order ESLint rule (#7852)
31 июл 2022, 19:05
Не верифицирован
31 июл 2022, 19:05
f683589
Код
Авторство
О чём код?
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import nprogress from 'nprogress'; import type {ClientModule} from '@docusaurus/types'; import './nprogress.css'; nprogress.configure({showSpinner: false}); const delay = 200; const clientModule: ClientModule = { onRouteUpdate({location, previousLocation}) { if (previousLocation && location.pathname !== previousLocation.pathname) { const progressBarTimeout = window.setTimeout(() => { nprogress.start(); }, delay); return () => window.clearTimeout(progressBarTimeout); } return undefined; }, onRouteDidUpdate() { nprogress.done(); }, }; export default clientModule;