Skip to content

Commit

Permalink
Moved service worker to root
Browse files Browse the repository at this point in the history
  • Loading branch information
Fran Linde Blázquez committed May 17, 2023
1 parent c8e759f commit 828ae91
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="/icons/icon-256.png">
<link rel="stylesheet" href="/styles/style.css">
<script src="/scripts/main.js"></script>
<script src="/main.js"></script>
<link rel="manifest" href="/pwa.webmanifest" />
<title>PWA Small Talk</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion scripts/main.js → main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Registro del Service Worker para habilitar la funcionalidad de PWA
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/scripts/service-worker.js');
navigator.serviceWorker.register('/service-worker.js');
}

// Función para pintar los datos de los pilotos en la página
Expand Down
3 changes: 2 additions & 1 deletion scripts/service-worker.js → service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ const cacheName = 'test-v1';
const appShellFiles = [
'/',
'/index.html',
'/scripts/main.js',
'/main.js',
'/styles/style.css',
'/icons/icon-128.png',
'/icons/icon-256.png',
'/icons/icon-512.png',
'/data/f1-drivers.json',
];
const driversImages = [];
for (let i = 1; i <= 10; i++) {
Expand Down

0 comments on commit 828ae91

Please sign in to comment.