diff --git a/index.html b/index.html index da2a4ab..a43fc01 100644 --- a/index.html +++ b/index.html @@ -206,6 +206,12 @@ + + \ No newline at end of file diff --git a/src/sw.js b/src/sw.js index e69de29..6a6ff53 100644 --- a/src/sw.js +++ b/src/sw.js @@ -0,0 +1,33 @@ +const assets = [ + '/', + '/index.html', + '/bin/bundle.min.js', + '/src/style.css', + '/ext/alata-latin-400.woff2', + '/ext/alata-latin-400.woff', + '/ext/fa.min.js', + '/ext/notyf.min.js', + '/jj2008-06-14.mk4_archive.torrent' +]; + +self.addEventListener('install', function(event) { + event.waitUntil( + caches.open('assets') + .then(function(cache) { + return cache.addAll(assets); + }) + ); +}); + +self.addEventListener('fetch', function(event) { + event.respondWith( + caches.match(event.request) + .then(function(response) { + if (response) { + return response; + } + return fetch(event.request); + } + ) + ); +}); \ No newline at end of file