1// Import Firebase scripts (compat versions for service workers) 2importScripts('https://www.gstatic.com/firebasejs/9.23.0/firebase-app-compat.js'); 3importScripts('https://www.gstatic.com/firebasejs/9.23.0/firebase-messaging-compat.js'); 4 5// Initialize Firebase in the service worker 6firebase.initializeApp({ 7 apiKey: 'AIzaSyDbcNh1ERQr7vJ2RdrU0WWqgRCgn9E5-E0', 8 authDomain: 'skmd-299311.firebaseapp.com', 9 databaseURL: 'https://skmd-299311-default-rtdb.firebaseio.com', 10 projectId: 'skmd-299311', 11 storageBucket: 'skmd-299311.appspot.com', 12 messagingSenderId: '168077504365', 13 appId: '1:168077504365:web:5e927e6be9da430a257464', 14 measurementId: 'G-SP3K3N9H8N', 15}); 16 17// Retrieve Firebase Messaging instance 18const messaging = firebase.messaging(); 19 20// Handle background messages 21messaging.onBackgroundMessage((payload) => { 22 console.log('[firebase-messaging-sw.js] Received background message', payload); 23 24 const notificationTitle = payload.notification?.title || 'Background Message'; 25 const notificationOptions = { 26 body: payload.notification?.body || 'You have a new message.', 27 icon: '/favicon.ico', // Replace with your app icon 28 }; 29 30 self.registration.showNotification(notificationTitle, notificationOptions); 31});
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.