hubl/src/scripts/register-sw.js

11 lines
284 B
JavaScript
Raw Normal View History

2020-12-03 10:58:08 +00:00
if('serviceWorker' in navigator) {
var refreshing;
navigator.serviceWorker.addEventListener('controllerchange', () => {
if (refreshing) {
return;
}
refreshing = true;
window.location.reload();
});
navigator.serviceWorker.register('/sw.js');
}