mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 18:29:52 +01:00
12 lines
360 B
JavaScript
12 lines
360 B
JavaScript
self.addEventListener('push', function (event) {
|
|
if (event.data) {
|
|
const notification = event.data.json();
|
|
console.log(event.data);
|
|
|
|
event.waitUntil(self.registration.showNotification(notification.title, {
|
|
body: notification.body
|
|
}));
|
|
} else {
|
|
console.error("Push event received, but it didn't contain any data.", event);
|
|
}
|
|
});
|