aboutsummaryrefslogtreecommitdiff
path: root/sw.js
diff options
context:
space:
mode:
Diffstat (limited to 'sw.js')
-rw-r--r--sw.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/sw.js b/sw.js
index 8976e07..8865b80 100644
--- a/sw.js
+++ b/sw.js
@@ -12,8 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-/** An empty service worker! */
+
+self.addEventListener('install', function(e) {
+ e.waitUntil(
+ caches.open('your-magic-cache').then(function(cache) {
+ return cache.addAll([
+ '/',
+ '/index.html',
+ '/Contact.html',
+ '/404.html',
+ '/css/*',
+ '/js/*',
+ '/mjolnir/*',
+ ]);
+ })
+ );
+});
self.addEventListener('fetch', function(event) {
- /** An empty fetch handler! */
+ event.respondWith(
+ caches.match(event.request).then(function(response) {
+ return response || fetch(event.request);
+ })
+ );
});