mirror of
https://github.com/a2nt/silverstripe-progressivewebapp.git
synced 2024-10-22 11:05:45 +02:00
Service worker
This commit is contained in:
parent
bde15f3cf2
commit
5f7c53ba5f
@ -1,6 +1,8 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
var baseHref = (document.getElementsByTagName('base')[0] || {}).href;
|
||||
if(baseHref){
|
||||
navigator.serviceWorker.register(baseHref + 'service-worker.js');
|
||||
navigator.serviceWorker.register(baseHref + 'service-worker.js').then(function() {
|
||||
//console.log('Service Worker Registered');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,26 @@
|
||||
self.addEventListener('fetch', (event) => {});
|
||||
self.addEventListener('install', function(e) {
|
||||
console.log('Install');
|
||||
/*
|
||||
e.waitUntil(
|
||||
caches.open('airhorner').then(function(cache) {
|
||||
return cache.addAll([
|
||||
'/',
|
||||
'/index.html',
|
||||
'/index.html?homescreen=1',
|
||||
'/?homescreen=1',
|
||||
'/styles/main.css',
|
||||
'/scripts/main.min.js',
|
||||
'/sounds/airhorn.mp3'
|
||||
]);
|
||||
})
|
||||
);
|
||||
*/
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', function(event) {
|
||||
console.log(event.request.url);
|
||||
});
|
||||
|
||||
self.addEventListener('beforeinstallprompt', function(event) {
|
||||
console.log('beforeinstallprompt');
|
||||
});
|
Loading…
Reference in New Issue
Block a user