First commit
This commit is contained in:
19
public/push-sw.js
Normal file
19
public/push-sw.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/* global self */
|
||||
|
||||
self.addEventListener('push', (event) => {
|
||||
const payload = event.data?.json?.() ?? {
|
||||
title: 'CertRemind',
|
||||
body: '証明書に関する通知があります',
|
||||
};
|
||||
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(payload.title || 'CertRemind', {
|
||||
body: payload.body || '証明書に関する通知があります',
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
event.notification.close();
|
||||
event.waitUntil(self.clients.openWindow('/'));
|
||||
});
|
||||
Reference in New Issue
Block a user