diff --git a/idea.whatwg.org/index.html b/idea.whatwg.org/index.html
index 7e502848a..8341cfb24 100644
--- a/idea.whatwg.org/index.html
+++ b/idea.whatwg.org/index.html
@@ -41,3 +41,8 @@
Ideas
+
+
diff --git a/idea.whatwg.org/service-worker.js b/idea.whatwg.org/service-worker.js
index f90c26930..4c84ed259 100644
--- a/idea.whatwg.org/service-worker.js
+++ b/idea.whatwg.org/service-worker.js
@@ -1,11 +1,2 @@
"use strict";
-
-self.cacheKey = "v1";
-self.toCache = [
- "/",
- "https://whatwg.org/style/shared.css",
- "https://whatwg.org/style/subpages.css",
- "https://resources.whatwg.org/logo.svg"
-];
-
importScripts("https://resources.whatwg.org/website-service-worker.js");
diff --git a/resources.whatwg.org/website-service-worker.js b/resources.whatwg.org/website-service-worker.js
index ede846092..3df8f5777 100644
--- a/resources.whatwg.org/website-service-worker.js
+++ b/resources.whatwg.org/website-service-worker.js
@@ -1,27 +1,30 @@
"use strict";
/* USAGE:
- self.cacheKey = "v1";
- self.toCache = "...";
+ // Optional:
+ self.cacheKey = "v3";
+ self.toCache = ["..."];
+
+ // Then:
importScripts("https://resources.whatwg.org/website-service-worker.js");
*/
-const cacheKey = "v1";
-const toCache = [
+const cacheKeyToUse = "v2_" + (self.cacheKey || "v0");
+const everythingToCache = [
"/",
"https://whatwg.org/style/shared.css",
"https://whatwg.org/style/subpages.css",
"https://resources.whatwg.org/logo.svg"
-];
+].concat(self.toCache || []);
self.oninstall = e => {
- e.waitUntil(caches.open(self.cacheKey).then(cache => cache.addAll(self.toCache)));
+ e.waitUntil(caches.open(cacheKeyToUse).then(cache => cache.addAll(everythingToCache)));
};
self.onactivate = e => {
e.waitUntil(caches.keys().then(keys => {
- return Promise.all(keys.filter(key => key !== self.cacheKey).map(key => caches.delete(key)));
+ return Promise.all(keys.filter(key => key !== cacheKeyToUse).map(key => caches.delete(key)));
}));
};
@@ -57,5 +60,5 @@ function refreshCacheFromNetworkResponse(req, res) {
const resForCache = res.clone();
- return caches.open(self.cacheKey).then(cache => cache.put(req, resForCache));
+ return caches.open(cacheKeyToUse).then(cache => cache.put(req, resForCache));
}
diff --git a/spec.whatwg.org/service-worker.js b/spec.whatwg.org/service-worker.js
index f90c26930..4c84ed259 100644
--- a/spec.whatwg.org/service-worker.js
+++ b/spec.whatwg.org/service-worker.js
@@ -1,11 +1,2 @@
"use strict";
-
-self.cacheKey = "v1";
-self.toCache = [
- "/",
- "https://whatwg.org/style/shared.css",
- "https://whatwg.org/style/subpages.css",
- "https://resources.whatwg.org/logo.svg"
-];
-
importScripts("https://resources.whatwg.org/website-service-worker.js");
diff --git a/whatwg.org/service-worker.js b/whatwg.org/service-worker.js
index 6573c4bec..4e7f311b5 100644
--- a/whatwg.org/service-worker.js
+++ b/whatwg.org/service-worker.js
@@ -1,10 +1,6 @@
"use strict";
-self.cacheKey = "v1";
self.toCache = [
- "/",
- "/shared.css",
- "/subpages.css",
"/img/arrow.svg",
"/img/bird-webpage.svg",
"/img/checker.svg",
@@ -21,8 +17,7 @@ self.toCache = [
"/code-of-conduct",
"/working-mode",
"/sg-agreement",
- "/sg-policy",
- "https://resources.whatwg.org/logo.svg"
+ "/sg-policy"
];
importScripts("https://resources.whatwg.org/website-service-worker.js");