Move service worker to ts file

This commit is contained in:
Hamcha 2020-06-18 13:54:09 +02:00
parent 44d1ed5de7
commit 9bd586d89c
Signed by untrusted user: 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>
</noscript>
<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>
</html>

View File

@ -12,3 +12,15 @@ const defaultTabs = [
defaultTabs.forEach((tab) => {
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);
});
}