|
|
|
@@ -32,9 +32,11 @@ |
|
|
|
<a href="" class="reload">Reload</a>
|
|
|
|
<a class="dismiss">🗙</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- The actual snackbar -->
|
|
|
|
<div id="snackbar">A new version of this app is available. Click <a id="reload" style="color:deepskyblue">here</a> to update.</div>
|
|
|
|
<div id="snackbarDiv">
|
|
|
|
<div id="snackbar">A new version of this app is available. Click <a id="reload" style="color:deepskyblue">here</a> to update. Eventually you have to restart the App manually.</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="_framework/blazor.webassembly.js"></script>
|
|
|
|
<script src="_content/TG.Blazor.IndexedDB/indexedDb.Blazor.js"></script>
|
|
|
|
@@ -42,13 +44,17 @@ |
|
|
|
let newWorker;
|
|
|
|
|
|
|
|
function showUpdateBar() {
|
|
|
|
let snackbarDiv = document.getElementById('snackbarDiv');
|
|
|
|
let snackbar = document.getElementById('snackbar');
|
|
|
|
snackbar.className = 'show';
|
|
|
|
snackbarDiv.className = 'show';
|
|
|
|
}
|
|
|
|
|
|
|
|
function hideUpdateBar() {
|
|
|
|
let snackbarDiv = document.getElementById('snackbarDiv');
|
|
|
|
let snackbar = document.getElementById('snackbar');
|
|
|
|
snackbar.className = '';
|
|
|
|
snackbarDiv.className = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
// The click event on the pop up notification
|
|
|
|
@@ -81,17 +87,13 @@ |
|
|
|
let refreshing;
|
|
|
|
navigator.serviceWorker.addEventListener('controllerchange', function () {
|
|
|
|
if (refreshing) return;
|
|
|
|
window.location.reload();
|
|
|
|
window.location = window.location.origin;
|
|
|
|
refreshing = true;
|
|
|
|
console.log('Reload to page ' + window.location.origin + ' on controller change.');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//if ('serviceWorker' in navigator) {
|
|
|
|
// navigator.serviceWorker.register('service-worker.js')
|
|
|
|
// .then((reg) => console.log('Service worker registered.', reg))
|
|
|
|
// .catch((err) => console.log('Failed to register Service worker.', err));
|
|
|
|
//}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function BlazorSetLocalStorage(key, value) {
|
|
|
|
localStorage.setItem(key, value);
|