Trevor Elliott преди 3 години
родител
ревизия
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")