PageSourceSearch

https://maxskills.io/firebase-messaging-sw.js

js maxskills.io collected 2026-10-02 02:00:17 UTC 1,830 bytes, 49 lines download raw bytes

1// Firebase Cloud Messaging service worker
2// Handles background push notifications on web.
3// The VITE_ env vars are NOT available here — values are injected at build time
4// by replacing the placeholders below, or you can hardcode them for production.
5
6importScripts('https://www.gstatic.com/firebasejs/10.12.0/firebase-app-compat.js');
7importScripts('https://www.gstatic.com/firebasejs/10.12.0/firebase-messaging-compat.js');
8
9const firebaseConfig = {
10  apiKey:            'AIzaSyDzrYicWFyqsPpoMrIYC-Bm5-1_pWsK3dg',
11  authDomain:        'maxskills-64b7a.firebaseapp.com',
12  projectId:         'maxskills-64b7a',
13  storageBucket:     'maxskills-64b7a.firebasestorage.app',
14  messagingSenderId: '16309982522',
15  appId:             '1:16309982522:web:f6593cf949c5f947e5ec03',
16};
17
18if (firebaseConfig.apiKey) {
19  firebase.initializeApp(firebaseConfig);
20
21  const messaging = firebase.messaging();
22
23  // Handle background messages (app not in foreground)
24  messaging.onBackgroundMessage((payload) => {
25    const { title, body, icon } = payload.notification ?? {};
26    self.registration.showNotification(title ?? 'MaxSkills', {
27      body:  body  ?? '',
28      icon:  icon  ?? '/icons/icon-192.png',
29      badge: '/icons/icon-192.png',
30      data:  payload.data,
31    });
32  });
33
34  // Open/focus the app when a notification is clicked
35  self.addEventListener('notificationclick', (event) => {
36    event.notification.close();
37    const url = event.notification.data?.url ?? '/';
38    event.waitUntil(
39      clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
40        for (const client of clientList) {
41          if (client.url.includes(self.location.origin) && 'focus' in client) {
42            return client.focus();
43          }
44        }
45        return clients.openWindow(url);
46      })
47    );
48  });
49}

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.