20 lines
515 B
JavaScript
20 lines
515 B
JavaScript
/* 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('/'));
|
|
});
|