blob: 8395c638f3ee0170e44b35bac866729371db70c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
function resetSw() {
return navigator.serviceWorker.getRegistrations().then(registrations => {
return Promise.all(registrations.map(r => r.unregister()));
});
}
async function registerSw(path) {
await resetSw();
add_completion_callback(resetSw);
const reg = await navigator.serviceWorker.register(path);
return reg;
}
|