From 54eaf7dcfb80a6570a79c7ab27fd4210c1c4fee0 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Fri, 24 Jan 2025 18:08:54 +0100 Subject: [PATCH] =?UTF-8?q?L=C3=A4gger=20till=20service=20worker=20och=20u?= =?UTF-8?q?ppdaterar=20manifest.json=20f=C3=B6r=20att=20st=C3=B6dja=20PWA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/app.js | 12 ++++++++++++ public/manifest.json | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/public/app.js b/public/app.js index 1ba958d..379bf62 100644 --- a/public/app.js +++ b/public/app.js @@ -1,3 +1,15 @@ +if ('serviceWorker' in navigator) { + window.addEventListener('load', () => { + navigator.serviceWorker.register('/service-worker.js') + .then(registration => { + console.log('ServiceWorker registration successful with scope: ', registration.scope); + }) + .catch(error => { + console.log('ServiceWorker registration failed: ', error); + }); + }); +} + document.getElementById('taskForm').addEventListener('submit', function(e) { e.preventDefault(); diff --git a/public/manifest.json b/public/manifest.json index 79067b4..e224ae7 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { - "name": "Task Manager", - "short_name": "TaskApp", - "description": "An app to manage tasks in Org mode format.", + "name": "Fredriks todos", + "short_name": "TODO", + "description": "Fredriks app to manage tasks in Org mode format.", "start_url": "/", "display": "standalone", "background_color": "#ffffff",