Skip to content

Commit 5edd20b

Browse files
committed
ok
1 parent bd8c3ec commit 5edd20b

14 files changed

+136
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

css/style.css

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
body {
2+
font-family: sans-serif;
3+
}
4+
5+
/* Make content area fill the entire browser window */
6+
html,
7+
.fullscreen {
8+
display: flex;
9+
height: 100%;
10+
margin: 0;
11+
padding: 0;
12+
width: 100%;
13+
}
14+
15+
/* Center the content in the browser window */
16+
.container {
17+
margin: auto;
18+
text-align: center;
19+
}
20+
21+
.title {
22+
font-size: 3rem;
23+
}

favicon.ico

14.7 KB
Binary file not shown.

images/hello-icon-128.png

3.27 KB
Loading

images/hello-icon-144.png

3.56 KB
Loading

images/hello-icon-152.png

3.77 KB
Loading

images/hello-icon-192.png

4.46 KB
Loading

images/hello-icon-256.png

5.8 KB
Loading

images/hello-icon-512.png

10.9 KB
Loading

index.html

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Hello World</title>
6+
<link rel="manifest" href="/manifest.json">
7+
<link rel="stylesheet" href="css/style.css">
8+
<link rel="icon" href="favicon.ico" type="image/x-icon" />
9+
<link rel="apple-touch-icon" href="images/hello-icon-152.png">
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
11+
<meta name="theme-color" content="white"/>
12+
<meta name="apple-mobile-web-app-capable" content="yes">
13+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
14+
<meta name="apple-mobile-web-app-title" content="Hello World">
15+
<meta name="msapplication-TileImage" content="images/hello-icon-144.png">
16+
<meta name="msapplication-TileColor" content="#FFFFFF">
17+
</head>
18+
<body class="fullscreen">
19+
<div class="container">
20+
<h1 class="title">Hello World!</h1>
21+
</div>
22+
<script src="js/main.js"></script>
23+
</body>
24+
</html>

js/main.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
window.onload = () => {
2+
'use strict';
3+
4+
if ('serviceWorker' in navigator) {
5+
navigator.serviceWorker
6+
.register('./sw.js');
7+
}
8+
}

manifest.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "Hello World",
3+
"short_name": "Hello",
4+
"icons": [{
5+
"src": "images/hello-icon-128.png",
6+
"sizes": "128x128",
7+
"type": "image/png"
8+
}, {
9+
"src": "images/hello-icon-144.png",
10+
"sizes": "144x144",
11+
"type": "image/png"
12+
}, {
13+
"src": "images/hello-icon-152.png",
14+
"sizes": "152x152",
15+
"type": "image/png"
16+
}, {
17+
"src": "images/hello-icon-192.png",
18+
"sizes": "192x192",
19+
"type": "image/png"
20+
}, {
21+
"src": "images/hello-icon-256.png",
22+
"sizes": "256x256",
23+
"type": "image/png"
24+
}, {
25+
"src": "images/hello-icon-512.png",
26+
"sizes": "512x512",
27+
"type": "image/png"
28+
}],
29+
"lang": "en-US",
30+
"start_url": "/index.html",
31+
"display": "standalone",
32+
"background_color": "white",
33+
"theme_color": "white"
34+
}

screenshot.jpg

20.9 KB
Loading

sw.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var cacheName = 'hello-pwa';
2+
var filesToCache = [
3+
'/',
4+
'/index.html',
5+
'/css/style.css',
6+
'/js/main.js'
7+
];
8+
9+
/* Start the service worker and cache all of the app's content */
10+
self.addEventListener('install', function(e) {
11+
e.waitUntil(
12+
caches.open(cacheName).then(function(cache) {
13+
return cache.addAll(filesToCache);
14+
})
15+
);
16+
self.skipWaiting();
17+
});
18+
19+
/* Serve cached content when offline */
20+
self.addEventListener('fetch', function(e) {
21+
e.respondWith(
22+
caches.match(e.request).then(function(response) {
23+
return response || fetch(e.request);
24+
})
25+
);
26+
});

0 commit comments

Comments
 (0)