Trevor Elliott 3 лет назад
Родитель
Сommit
738556da2f
2 измененных файлов с 6 добавлено и 6 удалено
  1. 5 5
      js/index.js
  2. 1 1
      lc/app.py

+ 5 - 5
js/index.js

@@ -27,6 +27,11 @@ let confirmDelete = (url, id) => {
 };
 
 document.addEventListener("DOMContentLoaded", () => {
+  if ('serviceWorker' in navigator) {
+    // TODO(trevor) does it matter if this fails?
+    navigator.serviceWorker.register('/service-worker.js')
+  }
+
   $(".deletelink").each((idx, elem) => {
     $(elem).on("click", (event) => {
       confirmDelete(event.target.dataset.url, event.target.dataset.linkId);
@@ -69,8 +74,3 @@ document.addEventListener("DOMContentLoaded", () => {
   });
 
 });
-
-if ('serviceWorker' in navigator) {
-  // TODO(trevor) does it matter if this fails?
-  navigator.serviceWorker.register('/service-worker')
-}

+ 1 - 1
lc/app.py

@@ -292,7 +292,7 @@ class PinboardImport(Endpoint):
         return self.api_ok(u.base_url())
 
 
-@endpoint("/service-worker")
+@endpoint("/service-worker.js")
 class ServiceWorker(Endpoint):
     def route(self, *args, **kwargs):
         return flask.send_file("../js/serviceWorker.js", mimetype="text/javascript")