Skip to content

Commit ec0e24e

Browse files
committed
More cache hacks
1 parent 993bc79 commit ec0e24e

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

web/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@
2626
});
2727
});
2828
} else {
29-
navigator.serviceWorker.register('sw.js');
29+
navigator.serviceWorker.register('sw.js').then(reg => {
30+
reg.addEventListener('updatefound', () => {
31+
const nw = reg.installing;
32+
if (!nw) return;
33+
nw.addEventListener('statechange', () => {
34+
if (nw.state === 'activated' && navigator.serviceWorker.controller) {
35+
location.reload();
36+
}
37+
});
38+
});
39+
});
3040
}
3141
}
3242
</script>

web/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const CACHE_NAME = 'boox-optimizer-v48';
1+
const CACHE_NAME = 'boox-optimizer-v49';
22

33
const APP_SHELL = [
44
'./',

0 commit comments

Comments
 (0)