diff options
author | tdro <tdro@noreply.example.com> | 2024-03-23 16:20:51 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2024-03-23 16:20:51 -0400 |
commit | 00cb6ffb1c481e39810580ac2474c5fd1b4ca214 (patch) | |
tree | 594acd396f60f3e4db54ace6a03715a4d9eab271 | |
parent | 8f3c9d30798b71e90a1d34e49e333560b836652f (diff) | |
download | canory-00cb6ffb1c481e39810580ac2474c5fd1b4ca214.tar.gz canory-00cb6ffb1c481e39810580ac2474c5fd1b4ca214.tar.bz2 canory-00cb6ffb1c481e39810580ac2474c5fd1b4ca214.zip |
static/js/update: Add default state
Handle more drift
-rw-r--r-- | assets/js/index.js | 2 | ||||
-rw-r--r-- | static/js/update.ts | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/assets/js/index.js b/assets/js/index.js index 3a0bdf6..d3ff7bf 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -117,7 +117,7 @@ const remote = request.getResponseHeader("last-modified") || document.lastModified; const modified = Date.parse(remote) > Date.parse(local); const drift = Date.parse(remote) - Date.parse(local); - if (drift < 3000) return; + if (drift < 10000) return; if (remote && modified) { fetch(url, "GET"); indicator.href = url; diff --git a/static/js/update.ts b/static/js/update.ts index 38d5925..1a3384f 100644 --- a/static/js/update.ts +++ b/static/js/update.ts @@ -13,6 +13,9 @@ return http; } + const state = "on"; + const key = "config.update"; + function update() { const url = self.location.href.split("#")[0].split("?")[0]; @@ -26,7 +29,7 @@ const modified = Date.parse(remote) > Date.parse(local); const drift = Date.parse(remote) - Date.parse(local); - if (drift < 3000) return; + if (drift < 10000) return; function reset() { indicator.href = anchor.href; |