mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-05 07:02:55 +00:00
Add ability to easily reset caches and worker
This commit is contained in:
parent
10fc27e13d
commit
55e8cc3bb8
2 changed files with 15 additions and 0 deletions
|
|
@ -60,6 +60,9 @@
|
||||||
</button>
|
</button>
|
||||||
<button id="test-notifications">Send test notification</button>
|
<button id="test-notifications">Send test notification</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<a href="#" id="reset-app">Reset</a>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<note-form mode="add" id="new-note">
|
<note-form mode="add" id="new-note">
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,18 @@ import {
|
||||||
} from "./notifications.js";
|
} from "./notifications.js";
|
||||||
import "./components.js";
|
import "./components.js";
|
||||||
|
|
||||||
|
async function resetApp() {
|
||||||
|
await window.navigator.serviceWorker
|
||||||
|
.getRegistration()
|
||||||
|
.then((r) => r.unregister());
|
||||||
|
await caches
|
||||||
|
.keys()
|
||||||
|
.then((keys) => Promise.all(keys.map((k) => caches.delete(k))));
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.querySelector("#reset-app").addEventListener("click", resetApp);
|
||||||
|
|
||||||
const URL_PARAMS = new URLSearchParams(window.location.search);
|
const URL_PARAMS = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
// Cookie presence determines login state
|
// Cookie presence determines login state
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue