Kenneth Bruen
2 years ago
3 changed files with 50 additions and 5 deletions
@ -0,0 +1,19 @@
|
||||
window.addEventListener('load', function (e) { |
||||
if (navigator.serviceWorker) { |
||||
navigator.serviceWorker.ready.then(function (reg) { |
||||
reg.active.postMessage({ |
||||
type: 'swVersionRequest', |
||||
}) |
||||
}) |
||||
navigator.serviceWorker.addEventListener('message', function (e) { |
||||
if ('type' in e.data) { |
||||
switch (e.data.type) { |
||||
case 'swVersion': { |
||||
document.getElementById('sw-version-div').classList.remove('hidden') |
||||
document.getElementById('sw-version').textContent = e.data.version |
||||
} |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
}) |
Loading…
Reference in new issue