Move service worker to ts file
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Hamcha 2020-06-18 13:54:09 +02:00
parent 44d1ed5de7
commit 9bd586d89c
Signed by: hamcha
GPG key ID: 41467804B19A3315
2 changed files with 12 additions and 16 deletions

View file

@ -53,21 +53,5 @@
<h2>JavaScript support is required to run this app.</h2> <h2>JavaScript support is required to run this app.</h2>
</noscript> </noscript>
<script src="src/index.ts" async></script> <script src="src/index.ts" async></script>
<script>
if ("serviceWorker" in navigator) {
const x = "sw.js";
navigator.serviceWorker
.register(x)
.then(function (registration) {
console.log(
"Registration successful, scope is:",
registration.scope
);
})
.catch(function (error) {
console.log("Service worker registration failed, error:", error);
});
}
</script>
</body> </body>
</html> </html>

View file

@ -12,3 +12,15 @@ const defaultTabs = [
defaultTabs.forEach((tab) => { defaultTabs.forEach((tab) => {
manager.openTab(tab.page, tab.active); manager.openTab(tab.page, tab.active);
}); });
if ("serviceWorker" in navigator) {
const x = "sw.js";
navigator.serviceWorker
.register(x)
.then((registration) => {
console.log("Registration successful, scope is:", registration.scope);
})
.catch((error) => {
console.log("Service worker registration failed, error:", error);
});
}