Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
guruakashsm authored Feb 6, 2024
1 parent 7fcf347 commit 8261cf6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions projects/rock-paper-scissor/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"short_name": "Portfolio",
"name": "My PWA Portfolio",
"icons": [
{
"src": "assets/images/logo.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "assets/images/logo.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": "/index.html",
"background_color": "#000000",
"display": "standalone",
"theme_color": "#ff0000"
}
20 changes: 20 additions & 0 deletions projects/rock-paper-scissor/sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// On install - caching the application shell
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('sw-cache').then(function(cache) {
// cache any static files that make up the application shell
return cache.add('index.html');
})
);
});

// On network request
self.addEventListener('fetch', function(event) {
event.respondWith(
// Try the cache
caches.match(event.request).then(function(response) {
//If response found return it, else fetch again
return response || fetch(event.request);
})
);
});

0 comments on commit 8261cf6

Please sign in to comment.