Browse Source

include the data in the logged info for a service worker "push"

starred-projects
Trent Larson 11 months ago
parent
commit
853eb3c623
  1. 10
      sw_scripts/additional-scripts.js

10
sw_scripts/additional-scripts.js

@ -28,13 +28,17 @@ function logConsoleAndDb(message, arg1, arg2) {
}
self.addEventListener("push", function (event) {
logConsoleAndDb("Service worker received a push event.", event);
let text = null;
if (event.data) {
text = event.data.text();
}
logConsoleAndDb("Service worker received a push event.", text, event);
event.waitUntil(
(async () => {
try {
let payload;
if (event.data) {
payload = JSON.parse(event.data.text());
if (text) {
payload = JSON.parse(text);
}
const message = await self.getNotificationCount();
if (message) {

Loading…
Cancel
Save