summaryrefslogtreecommitdiffstats
path: root/sw.js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-01-29 12:49:35 +0100
committerrstular <rok@stular.eu>2020-01-29 12:49:35 +0100
commita62819260d9c0d9bc0292f19be896c2c9b5ab422 (patch)
tree73794332dfdfc06d2ef00e11662a4238804da678 /sw.js
downloadbeziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar.gz
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar.bz2
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar.lz
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar.xz
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.tar.zst
beziapp-a62819260d9c0d9bc0292f19be896c2c9b5ab422.zip
Diffstat (limited to 'sw.js')
-rw-r--r--sw.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/sw.js b/sw.js
new file mode 100644
index 0000000..94a174e
--- /dev/null
+++ b/sw.js
@@ -0,0 +1,69 @@
+const static_cache_name = "site-static-v1";
+// Got them with du -a and minor cleaning up
+const assets = [
+ "/",
+ "/index.html",
+ "/login.html",
+ "/favicon.png",
+
+ "/img/icons/icon_144.png",
+ "/img/icons/icon_192.png",
+ "/img/icons/icon_72.png",
+ "/img/icons/icon_384.png",
+ "/img/icons/icon_48.png",
+ "/img/icons/icon_96.png",
+ "/img/icons/icon_512.png",
+
+ "/pages/absences.html",
+ "/pages/gradings.html",
+ "/pages/grades.html",
+ "/pages/teachers.html",
+ "/pages/timetable.html",
+
+ "/css/fullcalendar/custom.css",
+ "/css/fullcalendar/daygrid/main.min.css",
+ "/css/fullcalendar/timegrid/main.min.css",
+ "/css/fullcalendar/core/main.min.css",
+ "/css/styles.css",
+ "/css/materialicons.css",
+ "/css/materialize.min.css",
+
+ "/js/gradings.js",
+ "/js/login.js",
+ "/js/teachers.js",
+ "/js/initialize.js",
+ "/js/timetable.js",
+ "/js/app.js",
+ "/js/grades.js",
+ "/js/absences.js",
+
+ "/js/lib/materialize.min.js",
+ "/js/lib/fullcalendar/daygrid/main.min.js",
+ "/js/lib/fullcalendar/timegrid/main.min.js",
+ "/js/lib/fullcalendar/core/main.min.js",
+ "/js/lib/localforage.min.js",
+ "/js/lib/jquery.min.js"
+];
+
+importScripts("/js/lib/localforage.min.js");
+
+self.addEventListener("install", (evt) => {
+ // Add localforage.clear() if storage purge is required
+ evt.waitUntil(
+ localforage.clear()
+ );
+
+ evt.waitUntil(
+ caches.open(static_cache_name).then((cache) => {
+ cache.addAll(assets);
+ })
+ );
+});
+
+self.addEventListener("activate", evt => {
+
+})
+
+self.addEventListener("fetch", (evt) => {
+
+}); \ No newline at end of file