mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 13:56:32 +08:00
1 parent
ec2602746c
commit
eedfa72721
3 files changed
+14
-32
No files matched your search
@@ -522,10 +522,8 @@ const el = {
|
||||
searchNext: document.querySelector("#searchNext"),
|
||||
searchResults: document.querySelector("#searchResults"),
|
||||
metaPanel: document.querySelector(".meta-panel"),
|
||||
appPanel: document.querySelector("#appPanel"),
|
||||
renderVectorButton: document.querySelector("#renderVectorButton"),
|
||||
renderRasterButton: document.querySelector("#renderRasterButton"),
|
||||
offlineStatus: document.querySelector("#offlineStatus"),
|
||||
refreshAppButton: document.querySelector("#refreshAppButton"),
|
||||
metaFile: document.querySelector("#metaFile"),
|
||||
metaTitle: document.querySelector("#metaTitle"),
|
||||
@@ -4164,14 +4162,11 @@ async function registerOffline() {
|
||||
|
||||
async function prepareOffline() {
|
||||
if (nativeHost) {
|
||||
el.appPanel.hidden = false;
|
||||
el.offlineStatus.textContent = "可离线";
|
||||
return true;
|
||||
}
|
||||
if (!window.isSecureContext || !("serviceWorker" in navigator) || !("caches" in window) || !("locks" in navigator)) {
|
||||
return true;
|
||||
}
|
||||
el.appPanel.hidden = false;
|
||||
setProgress("正在准备离线", null, "正在准备离线");
|
||||
try {
|
||||
const registration = await registerOffline();
|
||||
@@ -4183,10 +4178,8 @@ async function prepareOffline() {
|
||||
if (navigator.storage?.persist) {
|
||||
navigator.storage.persist().catch(() => false);
|
||||
}
|
||||
el.offlineStatus.textContent = "可离线";
|
||||
watchApplicationUpdates(result.checksum);
|
||||
} catch {
|
||||
el.offlineStatus.textContent = "未就绪";
|
||||
}
|
||||
el.refreshAppButton.disabled = false;
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user