Skip to content

Commit 5488af9

Browse files
committed
registered service worker
1 parent 1e13130 commit 5488af9

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ ReactDOM.render(<App />, document.getElementById('root'));
99
// If you want your app to work offline and load faster, you can change
1010
// unregister() to register() below. Note this comes with some pitfalls.
1111
// Learn more about service workers: https://bit.ly/CRA-PWA
12-
serviceWorker.unregister();
12+
serviceWorker.register();

src/serviceWorker.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
// This optional code is used to register a service worker.
2-
// register() is not called by default.
3-
4-
// This lets the app load faster on subsequent visits in production, and gives
5-
// it offline capabilities. However, it also means that developers (and users)
6-
// will only see deployed updates on subsequent visits to a page, after all the
7-
// existing tabs open on the page have been closed, since previously cached
8-
// resources are updated in the background.
9-
10-
// To learn more about the benefits of this model and instructions on how to
11-
// opt-in, read https://bit.ly/CRA-PWA
12-
131
const isLocalhost = Boolean(
142
window.location.hostname === 'localhost' ||
153
// [::1] is the IPv6 localhost address.
@@ -25,9 +13,7 @@ export function register(config) {
2513
// The URL constructor is available in all browsers that support SW.
2614
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
2715
if (publicUrl.origin !== window.location.origin) {
28-
// Our service worker won't work if PUBLIC_URL is on a different origin
29-
// from what our page is served on. This might happen if a CDN is used to
30-
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
16+
3117
return;
3218
}
3319

0 commit comments

Comments
 (0)