diff --git a/index.html b/index.html index 94fdcaa..1dd5a66 100644 --- a/index.html +++ b/index.html @@ -51,6 +51,7 @@
+ Progressive Web Apps can be installed as an app. This page is one. +
+ + + + + diff --git a/pwatest.manifest.json b/pwatest.manifest.json new file mode 100644 index 0000000..c06af3b --- /dev/null +++ b/pwatest.manifest.json @@ -0,0 +1,17 @@ +{ + "name":"PWA Test", + "short_name":"PWA", + "start_url":"pwatest.html", + "display":"standalone", + "background_color":"#5900b3", + "theme_color":"black", + "scope": ".", + "description":"Tests out PWAs.", + "icons":[ + { + "src":"turtle.png", + "sizes":"250x250", + "type":"image/png" + } +] +} diff --git a/pwatest.service.js b/pwatest.service.js new file mode 100644 index 0000000..6d0d682 --- /dev/null +++ b/pwatest.service.js @@ -0,0 +1,19 @@ +var staticCacheName = "pwa"; + +self.addEventListener("install", function (e) { +e.waitUntil( + caches.open(staticCacheName).then(function (cache) { + return cache.addAll(["/", "/pwatest.html"]); + }) +); +}); + +self.addEventListener("fetch", function (event) { +console.log(event.request.url); + +event.respondWith( + caches.match(event.request).then(function (response) { + return response || fetch(event.request); + }) +); +}); diff --git a/turtle.png b/turtle.png new file mode 100644 index 0000000..1dbe788 Binary files /dev/null and b/turtle.png differ