mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 16:38:23 +01:00
clean up service worker registration
This commit is contained in:
parent
b2e21db0b3
commit
106a022632
1 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,7 @@ export async function signout() {
|
||||||
else await del('accounts');
|
else await del('accounts');
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Remove push notification registration
|
//#region Remove service worker registration
|
||||||
try {
|
try {
|
||||||
if (navigator.serviceWorker.controller) {
|
if (navigator.serviceWorker.controller) {
|
||||||
const registration = await navigator.serviceWorker.ready;
|
const registration = await navigator.serviceWorker.ready;
|
||||||
|
@ -46,6 +46,13 @@ export async function signout() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accounts.length === 0) {
|
||||||
|
await navigator.serviceWorker.getRegistrations()
|
||||||
|
.then(registrations => {
|
||||||
|
return Promise.all(registrations.map(registration => registration.unregister()));
|
||||||
|
})
|
||||||
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue