1/* eslint-disable no-restricted-globals */ 2/* eslint-disable no-undef */ 3// Scripts for firebase and firebase messaging 4importScripts( 5 "https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js" 6); 7importScripts( 8 "https://www.gstatic.com/firebasejs/9.0.0/firebase-messaging-compat.js" 9); 10 11// Firebase configuration 12const firebaseConfig = { 13 apiKey: "AIzaSyB4F0SjhJa_VhXRFYOoAauu2ZQi37cKDec", 14 15 authDomain: "ally-212a2.firebaseapp.com", 16 17 databaseURL: "https://ally-212a2-default-rtdb.firebaseio.com", 18 19 projectId: "ally-212a2", 20 21 storageBucket: "ally-212a2.appspot.com", 22 23 messagingSenderId: "707969564046", 24 25 appId: "1:707969564046:web:466f60b4249c78cd3b78df", 26}; 27 28// Initialize Firebase 29firebase.initializeApp(firebaseConfig); 30 31// Retrieve an instance of Firebase Messaging 32const messaging = firebase.messaging(); 33 34messaging.onBackgroundMessage((payload) => { 35 console.log( 36 "[firebase-messaging-sw.js] Received background message ", 37 payload 38 ); 39 40 const notificationTitle = payload?.notification?.body; 41 const notificationOptions = { 42 body: payload?.notification?.body, 43 icon: "logo-green-circle.png", 44 }; 45 46 const promiseChain = clients 47 .matchAll({ 48 type: "window", 49 includeUncontrolled: true, 50 }) 51 .then((windowClients) => { 52 for (let i = 0; i < windowClients.length; i++) { 53 const windowClient = windowClients[i]; 54 windowClient.postMessage(payload, "http://localhost:3000"); 55 } 56 }) 57 .then(() => 58 self.registration.showNotification(notificationTitle, notificationOptions) 59 ); 60 61 return promiseChain; 62}); 63 64self.addEventListener("message", (event) => { 65 event.notification.close(); 66 console.log("sw - message", event); 67});
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.