You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/04/19 12:57:39 UTC
[echarts-website] branch pwa updated: fix: remove tips for offline ready
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch pwa
in repository https://gitbox.apache.org/repos/asf/echarts-website.git
The following commit(s) were added to refs/heads/pwa by this push:
new b323a8aa fix: remove tips for offline ready
b323a8aa is described below
commit b323a8aa7b692c65fdfa0c044ce532d46d0a358d
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Tue Apr 19 20:56:30 2022 +0800
fix: remove tips for offline ready
---
.scripts/pwa/i18n.json | 2 --
.scripts/pwa/main.js | 16 ++++++----------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/.scripts/pwa/i18n.json b/.scripts/pwa/i18n.json
index 757cd0d5..3938ce63 100644
--- a/.scripts/pwa/i18n.json
+++ b/.scripts/pwa/i18n.json
@@ -2,13 +2,11 @@
"zh": {
"Reload": "刷新",
"Close": "关闭",
- "ReadyOffline": "当前页面已可以离线访问",
"NewContent": "有更新可用,点击”刷新“按钮获取最新内容"
},
"en": {
"Reload": "Reload",
"Close": "Close",
- "ReadyOffline": "App ready to work offline",
"NewContent": "New content available, click on reload button to update"
}
}
\ No newline at end of file
diff --git a/.scripts/pwa/main.js b/.scripts/pwa/main.js
index ffeb5253..50c4b22c 100644
--- a/.scripts/pwa/main.js
+++ b/.scripts/pwa/main.js
@@ -31,27 +31,23 @@ window.addEventListener('load', () => {
pwaToast.classList.remove('show', 'refresh')
}
- const showPwaToast = (offline) => {
- hidePwaToast()
- if (!offline) {
- pwaRefreshBtn.addEventListener('click', refreshCallback)
- pwaToast.classList.add('refresh')
- }
+ const showPwaToast = () => {
+ hidePwaToast()
- pwaToast.classList.add('show')
+ pwaRefreshBtn.addEventListener('click', refreshCallback)
+ pwaToast.classList.add('refresh', 'show')
}
pwaCloseBtn.addEventListener('click', hidePwaToast)
refreshSW = registerSW({
immediate: true,
onOfflineReady() {
- pwaToastMessage.innerHTML = lang['ReadyOffline']
- showPwaToast(true)
+ console.log('Page is ready to work offline')
},
onNeedRefresh() {
pwaToastMessage.innerHTML = lang['NewContent']
- showPwaToast(false)
+ showPwaToast()
}
})
})
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org