Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rizkyngrh23 authored Oct 22, 2024
1 parent bc434ee commit 426fb13
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Script/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "Guess the Number Game",
"short_name": "Number Game",
"start_url": "Script/guess_number.html",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#4a90e2",
"icons": [
{
"src": "Script/Assets/icon.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "Script/Assets/icon-large.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

28 changes: 28 additions & 0 deletions Script/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const CACHE_NAME = 'v1';
const urlsToCache = [
'./',
'./Script/guess_number.html',
'./Script/style-guess.css',
'./Script/game.js',
'./Script/manifest.json',
'./Assets/icon.png', // Update with the path to your icons
'./Assets/icon-large.png' // Update with the path to your large icon
];

self.addEventListener('install', event => {
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => {
return cache.addAll(urlsToCache);
})
);
});

self.addEventListener('fetch', event => {
event.respondWith(
caches.match(event.request)
.then(response => {
return response || fetch(event.request);
})
);
});

0 comments on commit 426fb13

Please sign in to comment.