PageSourceSearch

https://cre.ru/push-sw.js

js cre.ru collected 2026-09-24 08:35:36 UTC 825 bytes, 29 lines download raw bytes

1self.addEventListener('push', (event) => {
2  try {
3    const data = event.data?.json() || {};
4    event.waitUntil(
5      self.registration.showNotification(data.head || 'Новое уведомление', {
6        body: data.body || 'Текст новой новости',
7        icon: '/web-app-manifest-192x192.png',
8        badge: '/web-app-manifest-192x192.png',
9        data: {
10          url: data.url || '/',
11        },
12      })
13    );
14  } catch (error) {
15    console.error('Error handling push event:', error);
16  }
17});
18
19self.addEventListener('notificationclick', function(event) {
20  try {
21    event.notification.close();
22    const url = event.notification.data?.url;
23    event.waitUntil(
24      clients.openWindow(url)
25    );
26  } catch (error) {
27    console.error('Error handling notification click:', error);
28  }
29})

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.