Matthew Raymer
1 year ago
3 changed files with 18 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||||
|
self.addEventListener("push", function (event) { |
||||
|
let payload; |
||||
|
if (event.data) { |
||||
|
payload = JSON.parse(event.data.text()); |
||||
|
} |
||||
|
|
||||
|
const title = payload ? payload.title : "Custom Title"; |
||||
|
const options = { |
||||
|
body: payload ? payload.body : "Custom body text", |
||||
|
icon: payload ? payload.icon : "icon.png", |
||||
|
badge: payload ? payload.badge : "badge.png", |
||||
|
}; |
||||
|
|
||||
|
event.waitUntil(self.registration.showNotification(title, options)); |
||||
|
}); |
Loading…
Reference in new issue