SHA256
Добавить деплой без clean/тестов и доработки PWA/сессии в UI
This commit is contained in:
@@ -53,3 +53,25 @@ self.addEventListener('push', (event) => {
|
||||
}),
|
||||
]));
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
event.notification?.close();
|
||||
|
||||
event.waitUntil((async () => {
|
||||
const allClients = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
||||
const existing = allClients.find((client) => {
|
||||
try {
|
||||
return client.url.includes('/index.html') || client.url.endsWith('/');
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
await existing.focus();
|
||||
return;
|
||||
}
|
||||
|
||||
await self.clients.openWindow('./index.html');
|
||||
})());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user