diff --git a/lib/www/client/source/src/lib/deck.gl/DougalBinaryLoader.js b/lib/www/client/source/src/lib/deck.gl/DougalBinaryLoader.js index 5fe08cc..3e5bd3b 100644 --- a/lib/www/client/source/src/lib/deck.gl/DougalBinaryLoader.js +++ b/lib/www/client/source/src/lib/deck.gl/DougalBinaryLoader.js @@ -19,7 +19,7 @@ async function cachedFetch(url, init, opts = {}) { } } - if (opts?.cache) { + if (opts?.cache && window.cache) { cache = await caches.open(opts.cache.name); res = await cache.match(url); isCached = !!res; diff --git a/lib/www/client/source/src/store/modules/api/actions.js b/lib/www/client/source/src/store/modules/api/actions.js index 49d2e0b..b291805 100644 --- a/lib/www/client/source/src/store/modules/api/actions.js +++ b/lib/www/client/source/src/store/modules/api/actions.js @@ -61,7 +61,7 @@ async function api ({state, getters, commit, dispatch}, [resource, init = {}, cb } } - if (opts?.cache) { + if (opts?.cache && window.caches) { cache = await caches.open(opts.cache.name); res = await cache.match(url); isCached = !!res; diff --git a/lib/www/client/source/src/views/Map.vue b/lib/www/client/source/src/views/Map.vue index 95da4a8..31b8cea 100644 --- a/lib/www/client/source/src/views/Map.vue +++ b/lib/www/client/source/src/views/Map.vue @@ -879,13 +879,15 @@ export default { }, async refresh () { - const cache = await caches.open("dougal"); - for (const key of await cache.keys()) { - // Match only resolved requests - if (key instanceof Request) { - if (key.url?.match(`/project/${this.$route.params.project}`)) { - console.log("removing", key.method, key.url); - cache.delete(key); + if (window.caches) { + const cache = await caches.open("dougal"); + for (const key of await cache.keys()) { + // Match only resolved requests + if (key instanceof Request) { + if (key.url?.match(`/project/${this.$route.params.project}`)) { + console.log("removing", key.method, key.url); + cache.delete(key); + } } } }