Skip to content

Commit 9ba580a

Browse files
committed
Add SW registration
1 parent 63c2421 commit 9ba580a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

template/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@
1818
</head>
1919
<body>
2020
<div id="app"></div>
21+
<!-- Todo: only include in production -->
22+
<script>
23+
if('serviceWorker' in navigator) {
24+
navigator.serviceWorker.register('/service-worker.js', { scope: '/' })
25+
.then(function(registration) {
26+
console.log('Service Worker Registered');
27+
});
28+
29+
navigator.serviceWorker.ready.then(function(registration) {
30+
console.log('Service Worker Ready');
31+
});
32+
}
33+
</script>
2134
<!-- built files will be auto injected -->
2235
</body>
2336
</html>

0 commit comments

Comments
 (0)