-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created files and directories with basic codes and added funtional manifest and service worker
- Loading branch information
1 parent
9083cb8
commit 09ed808
Showing
13 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*{ | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
.page{ | ||
width: 100%; | ||
height: 100vh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="theme-color" content="#317EFB"/> | ||
<link rel="apple-touch-icon" href="app/icons/calc-maskable950.png"> | ||
<link rel="stylesheet" href="app.css"> | ||
<title>calculator</title> | ||
</head> | ||
<body> | ||
|
||
<div class="page"></div> | ||
|
||
<script src="app.js"></script> | ||
|
||
</body> | ||
</html> |
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> | ||
<link rel="shortcut icon" href="favicon.png" type="image/png"> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet"> | ||
<meta name="theme-color" content="#317EFB"/> | ||
<link rel="apple-touch-icon" href="app/icons/calc-maskable950.png"> | ||
<link rel="stylesheet" href="style.css"> | ||
<link rel="manifest" href="manifest.json"> | ||
<title>calulator PWA</title> | ||
</head> | ||
<body> | ||
|
||
<div class="main"> | ||
<div class="part1"> | ||
<h1>Simple responsive calculator PWA</h1> | ||
</div> | ||
<div class="part2"> | ||
<p>Use a chromium based browser for best experience !</p> | ||
<button id="install">Install</button> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
//install PWA on button click | ||
//not complete yet | ||
const install = document.getElementById('install') | ||
install.addEventListener('click',async=>{ | ||
console.log("clicked"); | ||
}); | ||
</script> | ||
<script src="script.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "calculator", | ||
"short_name": "calc", | ||
"start_url": "./app/app.html", | ||
"background_color": "#252525", | ||
"theme_color": "#000000", | ||
"display": "standalone", | ||
"icons":[ | ||
{ | ||
"src": "./app/icons/calc64.png", | ||
"sizes": "64x64", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "./app/icons/calc144.png", | ||
"sizes": "144x144", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "./app/icons/calc512.png", | ||
"sizes": "512x512", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"src": "./app/icons/calc-maskable950.png", | ||
"sizes": "950x950", | ||
"type": "image/png", | ||
"purpose": "maskable" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
if("serviceWorker" in navigator){ | ||
navigator.serviceWorker.register("service-worker.js").then(registration=>{ | ||
console.log("Service worker registered") | ||
console.log(registration); | ||
}).catch(error=>{ | ||
console.log("Service worker error") | ||
console.log(error); | ||
}) | ||
} | ||
else{ | ||
alert("Service worker not working") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const staticCache = "static v:00001"; | ||
const assets = [ | ||
"./app/app.html", | ||
"./app/app.css", | ||
"./app/app.js", | ||
"./app/icons/calc64.png", | ||
"./app/icons/calc144.png", | ||
"./app/icons/calc512.png", | ||
"./app/icons/calc-maskable950.png" | ||
]; | ||
|
||
//installing service worker | ||
self.addEventListener("install",event=>{ | ||
//caching assets | ||
event.waitUntil( | ||
caches.open("staticCache").then(cache=>{ | ||
return cache.addAll(assets); | ||
}) | ||
) | ||
}) | ||
|
||
self.addEventListener('activate',event=>{ | ||
event.waitUntil( | ||
//updating cache | ||
caches.keys().then(keys=>{ | ||
return Promise.all( | ||
keys.filter(staticCache=>{ | ||
}) | ||
.map(staticCache=>{ | ||
return caches.delete(keys); | ||
}) | ||
); | ||
}), | ||
); | ||
}) | ||
|
||
//fetch assets | ||
self.addEventListener("fetch",event=>{ | ||
//response to requests from cache if available else fetch from server | ||
event.respondWith( | ||
caches.match(event.request).then(response=>{ | ||
return response || fetch(event.request); | ||
}) | ||
); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
*{ | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
font-family: 'Roboto', sans-serif; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
.main{ | ||
width: 100%; | ||
height: 100vh; | ||
background: linear-gradient(to bottom right, #5a99a8, #062486); | ||
} | ||
|
||
.part1{ | ||
font-size: larger; | ||
font-weight: 700; | ||
text-align: center; | ||
padding-top: 4rem; | ||
} | ||
|
||
h1{ | ||
color: #f0f8ff; | ||
} | ||
|
||
.part2{ | ||
padding-top: 6rem; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: column; | ||
} | ||
|
||
p{ | ||
color: #e2bcbc; | ||
} | ||
|
||
button{ | ||
width: 80px; | ||
height: 30px; | ||
margin: 4rem; | ||
color: #f0f8ff; | ||
font-weight: bold; | ||
border-radius: 50px; | ||
border-color: #000000; | ||
cursor: pointer; | ||
background: linear-gradient(to bottom right, #0d8bdf, #0ec799); | ||
} |