feature: activate sw

This commit is contained in:
Jean-Baptiste Pasquier 2020-12-03 10:58:08 +00:00
parent 354807c512
commit 1d1f8de324

View File

@ -1,11 +1,11 @@
// if('serviceWorker' in navigator) {
// var refreshing;
// navigator.serviceWorker.addEventListener('controllerchange', () => {
// if (refreshing) {
// return;
// }
// refreshing = true;
// window.location.reload();
// });
// navigator.serviceWorker.register('/sw.js');
// }
if('serviceWorker' in navigator) {
var refreshing;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (refreshing) {
return;
}
refreshing = true;
window.location.reload();
});
navigator.serviceWorker.register('/sw.js');
}