PWA!
This commit is contained in:
45
Web/ServiceWorker.js
Normal file
45
Web/ServiceWorker.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
var cacheName = 'CandyFucker-v2';
|
||||||
|
var filesToCache = [
|
||||||
|
'./index.html',
|
||||||
|
'./style.css',
|
||||||
|
'./code/CandyFucker.js',
|
||||||
|
'./code/GameLib.js',
|
||||||
|
'./gfx/BallsBlue.png',
|
||||||
|
'./gfx/BallsCyan.png',
|
||||||
|
'./gfx/BallsGreen.png',
|
||||||
|
'./gfx/BallsRed.png',
|
||||||
|
'./gfx/BallsYellow.png',
|
||||||
|
'./gfx/favicon.ico',
|
||||||
|
'./gfx/favicon.png',
|
||||||
|
'./gfx/FragsBlue.png',
|
||||||
|
'./gfx/FragsCyan.png',
|
||||||
|
'./gfx/FragsGreen.png',
|
||||||
|
'./gfx/FragsRed.png',
|
||||||
|
'./gfx/FragsYellow.png',
|
||||||
|
'./gfx/logo.png',
|
||||||
|
//'../sfx/explosion1.wav',
|
||||||
|
//'../sfx/pickcandy.wav',
|
||||||
|
//'../sfx/swapinvalid.wav',
|
||||||
|
];
|
||||||
|
|
||||||
|
self.addEventListener('install', function (e) {
|
||||||
|
console.log('[ServiceWorker] Install');
|
||||||
|
e.waitUntil(
|
||||||
|
caches.open(cacheName).then(function (cache) {
|
||||||
|
console.log('[ServiceWorker] Caching app shell');
|
||||||
|
return cache.addAll(filesToCache);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
event.waitUntil(self.clients.claim());
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request, { ignoreSearch: true }).then(response => {
|
||||||
|
return response || fetch(event.request);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
BIN
Web/icons/icon-128.png
Normal file
BIN
Web/icons/icon-128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
BIN
Web/icons/icon-144.png
Normal file
BIN
Web/icons/icon-144.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Web/icons/icon-152.png
Normal file
BIN
Web/icons/icon-152.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
BIN
Web/icons/icon-192.png
Normal file
BIN
Web/icons/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
BIN
Web/icons/icon-512.png
Normal file
BIN
Web/icons/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -1,16 +1,19 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Candy Fucker</title>
|
<title>Candy Fucker</title>
|
||||||
<link rel="shortcut icon" href="gfx/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="gfx/favicon.ico" type="image/x-icon" />
|
||||||
<meta name="viewport"
|
<meta name="theme-color" content="#000000"/>
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||||
<link href="style.css" type="text/css" rel="stylesheet" />
|
<link href="style.css" type="text/css" rel="stylesheet" />
|
||||||
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="divLogo">
|
<div id="divLogo">
|
||||||
<img src="gfx/logo.png" alt="Candy Fucker"/>
|
<img src="gfx/logo.png" alt="Candy Fucker" />
|
||||||
</div>
|
</div>
|
||||||
<div id="divInfoDisplay"></div>
|
<div id="divInfoDisplay"></div>
|
||||||
<div id="divScreen">
|
<div id="divScreen">
|
||||||
@@ -19,7 +22,14 @@
|
|||||||
<script src="code/GameLib.js"></script>
|
<script src="code/GameLib.js"></script>
|
||||||
<script src="code/CandyFucker.js"></script>
|
<script src="code/CandyFucker.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.register('ServiceWorker.js')
|
||||||
|
.then(function () {
|
||||||
|
console.log('Service Worker Registered');
|
||||||
|
});
|
||||||
|
}
|
||||||
new CandyFucker("cnvScreen", "divInfoDisplay");
|
new CandyFucker("cnvScreen", "divInfoDisplay");
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
31
Web/manifest.json
Normal file
31
Web/manifest.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "Candy Fucker",
|
||||||
|
"short_name": "Candy Fucker",
|
||||||
|
"icons": [{
|
||||||
|
"src": "icons/icon-128.png",
|
||||||
|
"sizes": "128x128",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "icons/icon-144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "icons/icon-152.png",
|
||||||
|
"sizes": "152x152",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "icons/icon-192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "icons/icon-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": "index.html",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#000000",
|
||||||
|
"theme_color": "#000000"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user