ServiceWorker: skipWaiting and reload tabs when new ServiceWorker is ready
This commit is contained in:
parent
66399f754e
commit
174496c71d
2 changed files with 9 additions and 1 deletions
|
@ -31,7 +31,15 @@ function main() {
|
||||||
|
|
||||||
if (BuildConfig.NODE_ENV === 'production') {
|
if (BuildConfig.NODE_ENV === 'production') {
|
||||||
// avoid offline in dev mode because it's harder to debug
|
// avoid offline in dev mode because it's harder to debug
|
||||||
OfflinePluginRuntime.install();
|
// https://github.com/NekR/offline-plugin/pull/201#issuecomment-285133572
|
||||||
|
OfflinePluginRuntime.install({
|
||||||
|
onUpdateReady: function() {
|
||||||
|
OfflinePluginRuntime.applyUpdate();
|
||||||
|
},
|
||||||
|
onUpdated: function() {
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
perf.stop('main()');
|
perf.stop('main()');
|
||||||
});
|
});
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue