modified: index.html
modified: js/sw.js
This commit is contained in:
15
index.html
15
index.html
@@ -28,14 +28,13 @@
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('https://darkshy.bronyfurry.com/js/pwabuilder-sw.js').then(function(registration) {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
}, function(err) {
|
||||
console.log('ServiceWorker registration failed: ', err);
|
||||
});
|
||||
});
|
||||
if ('serviceWorker' in navigator) {
|
||||
// Весь код регистрации у нас асинхронный.
|
||||
navigator.serviceWorker.register('./sw.js')
|
||||
.then(() => navigator.serviceWorker.ready.then((worker) => {
|
||||
worker.sync.register('syncdata');
|
||||
}))
|
||||
.catch((err) => console.log(err));
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user