POC: Mobile notification via periodicSync
This commit is contained in:
parent
b14749c28f
commit
2aa97cf134
3 changed files with 78 additions and 6 deletions
16
public/sw.js
16
public/sw.js
|
|
@ -19,4 +19,18 @@ self.addEventListener("notificationclick", (e) => {
|
|||
.then((windowClient) => (windowClient ? windowClient.focus() : null));
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
async function checkNewMessages() {
|
||||
const cachedCredentials = await caches.open('cachedCredentials');
|
||||
// Todo...
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue