1importScripts('https://www.gstatic.com/firebasejs/8.4.3/firebase-app.js') 2importScripts('https://www.gstatic.com/firebasejs/8.4.3/firebase-messaging.js') 3 4firebase.initializeApp({ 5 apiKey: "AIzaSyAx9uOU6awdibE6-HQ28sVTgCcdoOSUWI0", 6 authDomain: "dostartu-push-test.firebaseapp.com", 7 projectId: "dostartu-push-test", 8 storageBucket: "dostartu-push-test.appspot.com", 9 messagingSenderId: "388058786669", 10 appId: "1:388058786669:web:1ba58abb39c8a671010864", 11 measurementId: "G-3HCPKVCFCQ" 12}); 13 14 15const messaging = firebase.messaging.isSupported() ? firebase.messaging() : null; 16 17messaging.setBackgroundMessageHandler(function(payload) { 18 console.log('Handling background message', payload); 19 20 // Copy data object to get parameters in the click handler 21 payload.data.data = JSON.parse(JSON.stringify(payload.data)); 22 23 return self.registration.showNotification(payload.data.title, payload.data); 24}); 25 26self.addEventListener('notificationclick', function(event) { 27 const target = event.notification.data.click_action || '/'; 28 event.notification.close(); 29 30 // This looks to see if the current is already open and focuses if it is 31 event.waitUntil(clients.matchAll({ 32 type: 'window', 33 includeUncontrolled: true 34 }).then(function(clientList) { 35 // clientList always is empty?! 36 for (var i = 0; i < clientList.length; i++) { 37 var client = clientList[i]; 38 if (client.url === target && 'focus' in client) { 39 return client.focus(); 40 } 41 } 42 43 return clients.openWindow(target); 44 })); 45});
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.