Skip to content
This repository has been archived by the owner on Dec 9, 2019. It is now read-only.

Commit

Permalink
chore(cleanup): cleanup index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
LasaleFamine committed Dec 4, 2017
1 parent a48a64b commit c944a6e
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,34 @@
</style>

<script>
if ('serviceWorker' in navigator) {
(function() {
if (!'serviceWorker' in navigator) {
console.log('Service worker is not supported');
return;
}

navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
registration.onupdatefound = function() {
if (navigator.serviceWorker.controller) {
var installingWorker = registration.installing;
installingWorker.onstatechange = function() {
switch (installingWorker.state) {
case 'installed':
break;
case 'redundant':
throw new Error('The installing ' +
'service worker became redundant.');
default:
// Ignore
}
};
}
};
}).catch(function(e) {
console.error('Error during service worker registration:', e);
});
} else {
console.log('Service worker is not supported');
}
installingWorker.onstatechange = function() {
switch (installingWorker.state) {
case 'installed':
break;
case 'redundant':
throw new Error('The installing ' +
'service worker became redundant.');
default:
// Ignore
}
};
}
};
}).catch(function(e) {
console.error('Error during service worker registration:', e);
});
})();

document.addEventListener('WebComponentsReady', function componentsReady() {
document.removeEventListener('WebComponentsReady', componentsReady, false);
Expand All @@ -87,7 +90,7 @@
var refScript = document.body.getElementsByTagName('script')[0];
refScript.parentNode.insertBefore(script, refScript);
refScript.parentNode.insertBefore(scriptModule, refScript);
}, false);
}, false);
</script>
</head>

Expand All @@ -97,7 +100,7 @@
</sk-app>

<script src="./vendor/custom-elements-es5-adapter.js" async nomodule></script>
<script src="./vendor/webcomponents-lite.js" async></script>
<script src="./vendor/webcomponents-loader.js" async></script>
</body>

</html>

0 comments on commit c944a6e

Please sign in to comment.