Add PWA update indicator.

This commit is contained in:
Paul
2021-06-28 10:17:38 +01:00
parent e27f1bf9d6
commit 84da056f09
4 changed files with 33 additions and 5 deletions

View File

@@ -1,9 +1,9 @@
import { registerSW } from 'virtual:pwa-register'
const updateSW = registerSW({
import { registerSW } from 'virtual:pwa-register';
import { internalEmit } from './lib/eventEmitter';
export const updateSW = registerSW({
onNeedRefresh() {
// ! FIXME: temp
updateSW(true);
// show a prompt to user
internalEmit('PWA', 'update');
},
onOfflineReady() {
console.info('Ready to work offline.');