From 2760e70c8e266a1d727f53fdaeeeab091af29461 Mon Sep 17 00:00:00 2001 From: Fay Arnold Date: Thu, 8 Apr 2021 14:20:14 +0100 Subject: [PATCH] remove js template --- djangoldp_webpushnotification/templates/sw.js | 18 ------------------ djangoldp_webpushnotification/urls.py | 6 ------ 2 files changed, 24 deletions(-) delete mode 100644 djangoldp_webpushnotification/templates/sw.js diff --git a/djangoldp_webpushnotification/templates/sw.js b/djangoldp_webpushnotification/templates/sw.js deleted file mode 100644 index 478340a..0000000 --- a/djangoldp_webpushnotification/templates/sw.js +++ /dev/null @@ -1,18 +0,0 @@ -// Register event listener for the 'push' event. -self.addEventListener("push", function (event) { - // Retrieve the textual payload from event.data (a PushMessageData object). - // Other formats are supported (ArrayBuffer, Blob, JSON), check out the documentation - // on https://developer.mozilla.org/en-US/docs/Web/API/PushMessageData. - const eventInfo = event.data.text(); - const data = JSON.parse(eventInfo); - const head = data.head || "New Notification πŸ•ΊπŸ•Ί"; - const body = data.body || "This is default content. Your notification didn't have one πŸ™„πŸ™„"; - - // Keep the service worker alive until the notification is created. - event.waitUntil( - self.registration.showNotification(head, { - body: body, - icon: "https://i.imgur.com/MZM3K5w.png", - }) - ); -}); diff --git a/djangoldp_webpushnotification/urls.py b/djangoldp_webpushnotification/urls.py index 1551ac2..aaf42e9 100644 --- a/djangoldp_webpushnotification/urls.py +++ b/djangoldp_webpushnotification/urls.py @@ -6,10 +6,4 @@ from .views import home, send_push urlpatterns = [ path("send_push", send_push), path("webpush/", include("webpush.urls")), - path( - "sw.js", - TemplateView.as_view( - template_name="sw.js", content_type="application/x-javascript" - ), - ), ]