File: service-worker.js

package info (click to toggle)
golang-github-sherclockholmes-webpush-go 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 124 kB
  • sloc: javascript: 9; makefile: 4
file content (11 lines) | stat: -rw-r--r-- 332 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
self.addEventListener('push', event => {
  console.log('[Service Worker] Push Received.');
  console.log(`[Service Worker] Push had this data: "${event.data.text()}"`);

  const title = 'Test Webpush';
  const options = {
    body: event.data.text(),
  };

  event.waitUntil(self.registration.showNotification(title, options));
});