diff --git a/www/cache.js b/www/cache.js index 812062c..29760a0 100644 --- a/www/cache.js +++ b/www/cache.js @@ -126,6 +126,8 @@ for (i in SETTINGS.weathericons) { cachedurls.push("assets/images/weather-" + SETTINGS.weathericons[i] + ".svg"); } +var cacheFilled = false; + function fillCache(cachename) { if ('caches' in window) { // delete old caches @@ -137,15 +139,22 @@ function fillCache(cachename) { })); }); + cacheFilled = true; // assume good caches.open(cachename).then(function (cache) { for (i in cachedurls) { - cache.add(cachedurls[i]); + try { + cache.add(cachedurls[i]); + } catch (ex) { + cacheFilled = false; + } } }); - // Do it again in a little while to reduce chance of errors - setTimeout(function () { - fillCache(cachename); - }, 1000 * 30); + // Do it again in a little while + if (!cacheFilled) { + setTimeout(function () { + fillCache(cachename); + }, 1000 * 30); + } } } \ No newline at end of file diff --git a/www/index.html b/www/index.html index 210dfd8..0ef2e31 100644 --- a/www/index.html +++ b/www/index.html @@ -69,7 +69,9 @@