more firefox 52 fixes
This commit is contained in:
parent
d8ec3ce019
commit
6e64e505f9
@ -24,15 +24,15 @@ async function unregisterPush() {
|
||||
checkServiceWorkerSupport();
|
||||
try {
|
||||
const registrations = await navigator.serviceWorker.getRegistrations();
|
||||
if (!registrations?.length) return;
|
||||
if (!registrations || registrations.length === 0) return;
|
||||
|
||||
await Promise.all(
|
||||
registrations.map(async (reg) => {
|
||||
const sub = await reg.pushManager.getSubscription();
|
||||
if (sub) await sub.unsubscribe();
|
||||
await reg.unregister();
|
||||
})
|
||||
);
|
||||
for (let i = 0; i < registrations.length; i++) {
|
||||
const reg = registrations[i];
|
||||
const sub = await reg.pushManager.getSubscription();
|
||||
|
||||
if (sub) await sub.unsubscribe();
|
||||
await reg.unregister();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to unregister push:", err);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
try {
|
||||
await (checked ? registerPush(publicKey) : unregisterPush());
|
||||
return true;
|
||||
} catch {
|
||||
} catch(error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user