Skip to content

Commit

Permalink
added
Browse files Browse the repository at this point in the history
  • Loading branch information
elangov1 committed Oct 25, 2018
1 parent 65bb386 commit bfe8203
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
//alert("if loop ==>");
navigator.serviceWorker.register('service-worker.js').then(function (registration) {
//alert("if loop ==>"+registration.scope);
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function (err) {
console.log('ServiceWorker registration failed: ', err);
Expand All @@ -84,6 +86,7 @@
});
});
} else {
alert("elase loop ==>");
console.log('service worker is not supported');
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion public/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var doCache = true;

alert("LEaf ===> "+doCache);
var CACHE_NAME = "my-pwa-cache-v1";

self.addEventListener("activate", event => {
Expand Down
4 changes: 2 additions & 2 deletions src/serviceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const isLocalhost = Boolean(
);

export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
//if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
if (publicUrl.origin !== window.location.origin) {
Expand Down Expand Up @@ -51,7 +51,7 @@ export function register(config) {
registerValidSW(swUrl, config);
}
});
}
// }
}

function registerValidSW(swUrl, config) {
Expand Down

0 comments on commit bfe8203

Please sign in to comment.