Skip to content

Commit

Permalink
added sw.js script to teamdetails, added files to sw.js cache
Browse files Browse the repository at this point in the history
  • Loading branch information
joypan1 committed Feb 26, 2024
1 parent 5ed3f70 commit 9e6e247
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pages/aboutus.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
width: 50px; /* Adjust the width as needed */
}
</style>

<script>
// Check that service workers are supported
if ("serviceWorker" in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener("load", () => {
navigator.serviceWorker.register("./sw.js");
});
}
</script>

</head>
<body>
<nav>
Expand Down
11 changes: 11 additions & 0 deletions pages/teamdetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
<title> Team Details</title>
<link rel="stylesheet" href="teams.css" />
<script src="https://unpkg.com/dexie/dist/dexie.js"></script>

<script>
// Check that service workers are supported
if ("serviceWorker" in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener("load", () => {
navigator.serviceWorker.register("./sw.js");
});
}
</script>

</head>
<body>

Expand Down
2 changes: 1 addition & 1 deletion sw.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const cacheName = "offline-cache-v1";
const cacheUrls = ["index.html","index.js","manifest.json","sw.js","index.css","node_modules\\dexie\\","pages\\", "teams.css"];
const cacheUrls = ["index.html","index.js","manifest.json","sw.js","index.css","node_modules\\dexie\\","pages\\", "teams.css", "aboutus.html", "teamdetails.html", "teamdetails.js"];

// Installing the Service Worker
self.addEventListener("install", async (event) => {
Expand Down

0 comments on commit 9e6e247

Please sign in to comment.