1self.addEventListener('fetch', () => { 2 const urlParameters = new URLSearchParams(location.search) 3 const objectParameters = Object.fromEntries(urlParameters) 4 self.firebaseConfig = objectParameters 5}) 6 7self.addEventListener('notificationclick', function (event) { 8 const notificationUrl = 9 event?.notification?.data?.FCM_MSG?.data?.url || self.location.origin 10 event.waitUntil( 11 self.clients 12 .matchAll({ type: 'window' }) 13 .then(clientsArray => 14 clientsArray.filter(client => client.url === self.location.origin) 15 ) 16 .then(matchingClients => { 17 if (matchingClients[0]) { 18 return matchingClients[0] 19 .navigate(notificationUrl) 20 .then(client => client.focus()) 21 } 22 23 return self.clients.openWindow(notificationUrl) 24 }) 25 ) 26}) 27 28/* eslint-disable no-undef */ 29importScripts('https://www.gstatic.com/firebasejs/9.0.0/firebase-app-compat.js') 30importScripts( 31 'https://www.gstatic.com/firebasejs/9.0.0/firebase-messaging-compat.js' 32) 33/* eslint-enable no-undef */ 34 35const defaultConfig = { 36 apiKey: true, 37 projectId: true, 38 messagingSenderId: true, 39 appId: true, 40} 41 42/* eslint-disable no-undef */ 43firebase.initializeApp(self.firebaseConfig || defaultConfig) 44 45firebase.messaging() 46/* eslint-enable no-undef */
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.