merge master and improvements

This commit is contained in:
10G Meow 2024-03-09 11:15:48 +02:00
commit 7444891b6d
21 changed files with 748 additions and 208 deletions

View file

@ -1,8 +1,6 @@
// Notification click event listener
self.addEventListener("notificationclick", (e) => {
// Close the notification popout
e.notification.close();
// Get all the Window clients
e.waitUntil(
clients.matchAll({ type: "window" }).then((clientsArr) => {
// If a Window tab matching the targeted URL already exists, focus that;
@ -26,9 +24,10 @@ async function checkNewMessages() {
// Todo...
}
// Install PWA in mobile or web to test if periodicSync notification works
// see browser compatibility: https://developer.mozilla.org/en-US/docs/Web/API/Web_Periodic_Background_Synchronization_API#browser_compatibility
self.addEventListener('periodicsync', (event) => {
if (event.tag === 'check-new-messages') {
// Test if periodicSync notification triggers in Mobile app(created via add to homescreen)
self.registration.showNotification("Notification via periodicSync");
event.waitUntil(checkNewMessages());