Skip to content

Commit

Permalink
Deploying to gh-pages from @ 2b3f3ba 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadalm committed Jan 6, 2024
1 parent 48c7b13 commit 8075363
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#121212">
<meta name="app-version" content="7ab606b742aa7571ac2abcade21557fbbae64cd9">
<meta name="app-version" content="2b3f3baca58df679e9c2274b997c8eb2987b190b">
<meta name="description" content="Backgammon app that works offline.">
<title>Backgammon</title>
<link rel="stylesheet" href="css/styles.db66a53c8904774df80ed2dacb765b8191c11396.css">
Expand Down
2 changes: 1 addition & 1 deletion js/app.57C0EE03D68039FF5C3BFCDD552374FC.js.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions worker.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const relatedAppVersion = "7ab606b742aa7571ac2abcade21557fbbae64cd9";
const relatedAppVersion = "2b3f3baca58df679e9c2274b997c8eb2987b190b";
const urlsToCache = ["index.html","manifest.json","img/icon.svg","js/app.57C0EE03D68039FF5C3BFCDD552374FC.js","css/styles.db66a53c8904774df80ed2dacb765b8191c11396.css"];

const cacheKey = `resources.${relatedAppVersion}`;
const cacheKeyPrefix = 'nenadalm.backgammon.';
const cacheKey = `${cacheKeyPrefix}resources.${relatedAppVersion}`;

function ensureHtmlVersionMatches(cache) {
return cache.match(new Request('/index.html'))
return cache.match(new Request('index.html'))
.then(response => response.text())
.then(html => html.match(/<meta name="app-version" content="(.*?)">/)[1])
.then(version => {
Expand All @@ -23,6 +24,7 @@ self.addEventListener('install', event => {
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys()
.then(keys => keys.filter(key => key.startsWith(cacheKeyPrefix)))
.then(keys => keys.filter(key => key !== cacheKey))
.then(oldKeys => Promise.all(oldKeys.map(key => caches.delete(key))))
);
Expand Down

0 comments on commit 8075363

Please sign in to comment.