enhanceApp.js 573 Bytes
Newer Older
1 2
import event from '@vuepress/plugin-pwa/lib/event'

3
export default ({ router }) => {
4 5
  registerAutoReload();
  
6 7 8 9
  router.addRoutes([
    { path: '/docs/', redirect: '/' },
  ])
}
10 11 12 13 14 15 16 17 18 19

// When new content is detected by the app, this will automatically
// refresh the page, so that users do not need to manually click
// the refresh button. For more details see:
// https://linear.app/optimism/issue/FE-1003/investigate-archive-issue-on-docs
const registerAutoReload = () => {
    event.$on('sw-updated', e => e.skipWaiting().then(() => {
      location.reload(true);
    }))
}