mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 07:16:18 -04:00
Speed up update process by skipping waiting and claiming currently open pages -> no need to close all tabs in order to get an update anymore
This commit is contained in:
parent
d18e290ad4
commit
dbd6321fec
1 changed files with 6 additions and 2 deletions
|
@ -69,14 +69,16 @@ const relativePathsNotToCache = [
|
||||||
]
|
]
|
||||||
|
|
||||||
self.addEventListener('install', function(event) {
|
self.addEventListener('install', function(event) {
|
||||||
// Perform install steps
|
// Perform install steps
|
||||||
|
console.log("Cache files for sw:", cacheVersion);
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
caches.open(cacheTitle)
|
caches.open(cacheTitle)
|
||||||
.then(function(cache) {
|
.then(function(cache) {
|
||||||
return cache
|
return cache
|
||||||
.addAll(relativePathsToCache)
|
.addAll(relativePathsToCache)
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
console.log('All files cached.');
|
console.log('All files cached for sw:', cacheVersion);
|
||||||
|
self.skipWaiting();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -182,6 +184,8 @@ self.addEventListener('fetch', function(event) {
|
||||||
|
|
||||||
// on activation, we clean up the previously registered service workers
|
// on activation, we clean up the previously registered service workers
|
||||||
self.addEventListener('activate', evt => {
|
self.addEventListener('activate', evt => {
|
||||||
|
console.log("Activate sw:", cacheVersion);
|
||||||
|
evt.waitUntil(clients.claim());
|
||||||
return evt.waitUntil(
|
return evt.waitUntil(
|
||||||
caches
|
caches
|
||||||
.keys()
|
.keys()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue