Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit edd02fc

Browse files
unregister code changed
1 parent 9c42eef commit edd02fc

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

public/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
<meta name="theme-color" content="#000000" />
88
<meta name="description" content="Todo App" />
99
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
10-
<!-- <link rel="apple-touch-icon" href="./logo192.png" /> -->
1110
<!--
1211
manifest.json provides metadata used when your web app is installed on a
1312
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1413
-->
1514
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
16-
<!-- <link rel="manifest" href="./manifest.json" /> -->
1715
<!--
1816
Notice the use of %PUBLIC_URL% in the tags above.
1917
It will be replaced with the URL of the `public` folder during the build.
@@ -41,10 +39,9 @@
4139
<script>
4240
if ('serviceWorker' in navigator) {
4341
window.addEventListener('load', () => {
42+
console.log('serviceWorker custom');
4443
navigator.serviceWorker
45-
.register('./serviceworker.js', {
46-
// scope: '.', // <--- THIS BIT IS REQUIRED
47-
})
44+
.register('./my-serviceworker.js')
4845
.then((reg) => console.log('Success: ', reg.scope))
4946
.catch((err) => console.log('Failure: ', err));
5047
});

public/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "Todo App",
3-
"name": "Todo App PWA",
2+
"short_name": "Todo app v2",
3+
"name": "Todo app PWA v2",
44
"icons": [
55
{
66
"src": "favicon.ico",

public/serviceworker.js renamed to public/my-serviceworker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
const CACHE_NAME = 'version-1';
2-
const urlsToCache = ['index.html', 'offline.html'];
2+
const urlsToCache = [
3+
'index.html',
4+
'offline.html',
5+
'https://todo-restapi-app.herokuapp.com/api/todos?all=true',
6+
'/todo',
7+
];
38

49
const self = this;
510

public/offline.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<body>
3838
<div class="city">
3939
<h2 class="city-name">
40-
<span>Please go to online.</span>
40+
<span>Please go to online 1.</span>
4141
</h2>
4242
</div>
4343
</body>

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ ReactDOM.render(
2121
// If you want your app to work offline and load faster, you can change
2222
// unregister() to register() below. Note this comes with some pitfalls.
2323
// Learn more about service workers: https://bit.ly/CRA-PWA
24-
serviceWorker.register();
24+
serviceWorker.unregister();

0 commit comments

Comments
 (0)