diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index 22083642d8..1ff8374739 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -374,37 +374,6 @@ Note that it's `off` by default. If given a `string`, it will be displayed as a - [@vuepress/plugin-last-updated](../plugin/official/plugin-last-updated.md) -## Service Worker - -The `themeConfig.serviceWorker` option allows you to configure the service worker. - -::: tip -Please do not confuse this option with [Config > serviceWorker](../config/README.md#serviceworker), [Config > serviceWorker](../config/README.md#serviceworker) is **site-level**, while this option is **theme-level**. -::: - -### Popup UI to refresh contents - -The `themeConfig.serviceWorker.updatePopup` option enables a popup to refresh site content. The popup will be shown when the site is updated (i.e. service worker is updated). It provides a `refresh` button to allow users to refresh contents immediately. - -::: tip NOTE -If without the `refresh` button, the new service worker will be active after all [clients](https://developer.mozilla.org/en-US/docs/Web/API/Clients) are closed. This means that visitors cannot see new contents until they close all tabs of your site. But the `refresh` button activates the new service worker immediately. -::: - -``` js -module.exports = { - themeConfig: { - serviceWorker: { - updatePopup: true // Boolean | Object, default to undefined. - // If set to true, the default text config will be: - // updatePopup: { - // message: "New content is available.", - // buttonText: "Refresh" - // } - } - } -} -``` - ## Prev / Next Links Prev and next links are automatically inferred based on the sidebar order of the active page. You can also explicitly overwrite or disable them using `YAML front matter`: diff --git a/packages/docs/docs/zh/theme/default-theme-config.md b/packages/docs/docs/zh/theme/default-theme-config.md index 8516cf5fe0..843079e01d 100644 --- a/packages/docs/docs/zh/theme/default-theme-config.md +++ b/packages/docs/docs/zh/theme/default-theme-config.md @@ -369,37 +369,6 @@ module.exports = { - [@vuepress/plugin-last-updated](../plugin/official/plugin-last-updated.md) -## Service Worker - -`themeConfig.serviceWorker` 允许你去配置 Service Worker。 - -::: tip 提示 -请不要将本选项与 [Config > serviceWorker](../config/README.md#serviceworker) 混淆,[Config > serviceWorker](../config/README.md#serviceworker) 是网站级别的配置,而本选项是主题级别的配置。 -::: - -### 刷新内容的弹窗 - -开启 `themeConfig.serviceWorker.updatePopup` 选项,将开启一个能够刷新内容的弹窗。当网站更新(即 Service Worker 更新)时,它会提供一个 `refresh` 按钮,允许用户立刻刷新内容。 - -::: tip 提示 -如果没有 `refresh` 按钮,新的 service worker 将在所有的 [clients](https://developer.mozilla.org/en-US/docs/Web/API/Clients) 关闭后才会处于活动状态。这意味着访问者在关闭你网站的所有标签之前将无法看到新内容。但是,`refresh` 按钮可以立即激活新的 Service Worker。 -::: - -``` js -module.exports = { - themeConfig: { - serviceWorker: { - updatePopup: true // Boolean | Object, 默认值是 undefined. - // 如果设置为 true, 默认的文本配置将是: - // updatePopup: { - // message: "New content is available.", - // buttonText: "Refresh" - // } - } - } -} -``` - ## 上 / 下一篇链接 上一篇和下一篇文章的链接将会自动地根据当前页面的侧边栏的顺序来获取。你也可以使用 `YAML front matter` 来明确地重写或者禁用它: