File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -107,13 +107,24 @@ footer {
107107if ("serviceWorker" in navigator) {
108108 window.addEventListener("load", () => {
109109 navigator.serviceWorker.register("/service-worker.js").then((registration) => {
110- console.log("ServiceWorker registered: ", registration);
110+ registration.pushManager.getSubscription()
111+
112+ self.addEventListener("push", (event: any) => {
113+ const payload = event.data?.text() ?? "no payload";
114+ event.waitUntil(
115+ registration.showNotification("EP 2025", {
116+ body: payload,
117+ }),
118+ );
119+ });
120+
111121 }).catch((registrationError) => {
112122 console.log("ServiceWorker registration failed: ", registrationError);
113123 });
114124 });
115125}
116126
127+
117128document.addEventListener('DOMContentLoaded', () => {
118129 if (window.matchMedia('(display-mode: standalone)').matches) {
119130 document.addEventListener('click', function (e: Event) {
You can’t perform that action at this time.
0 commit comments