1 importScripts( 2 'https://www.gstatic.com/firebasejs/9.23.0/firebase-app-compat.js' 3 ) 4 importScripts( 5 'https://www.gstatic.com/firebasejs/9.23.0/firebase-messaging-compat.js' 6 ) 7 firebase.initializeApp({"apiKey":"AIzaSyAfSiLd_6_ddTpgwpbYP2Gj1ycbZYhVqiU","authDomain":"nuxt-aio-bundle-lqj.firebaseapp.com","projectId":"nuxt-aio-bundle-lqj","storageBucket":"nuxt-aio-bundle-lqj.appspot.com","messagingSenderId":"27403134995","appId":"1:27403134995:web:37908bd25daef8bfab77e6","measurementId":null,"databaseURL":"https:\u002F\u002Fnuxt-aio-bundle-lqj-default-rtdb.europe-west1.firebasedatabase.app"}) 8 9 // Retrieve an instance of Firebase Messaging so that it can handle background 10 // messages. 11 const messaging = firebase.messaging() 12 13 // Setup event listeners for actions provided in the config: 14 self.addEventListener('notificationclick', function(e) { 15 const actions = [] 16 const action = actions.find(x => x.action === e.action) 17 const notification = e.notification 18 19 if (!action) return 20 21 if (action.url) { 22 clients.openWindow(action.url) 23 notification.close() 24 } 25 }) 26 27 let list_notification = []; 28 29// listen to push events 30self.addEventListener('push', function(event) { 31 console.log('[Service Worker] Push Received.'); 32 33 console.log(event.data.text() === 'Test push message from DevTools.') 34 35 if(event.data.text() === 'Test push message from DevTools.') { 36 console.log('[Service Worker] Push had this data: "Test push message from DevTools."'); 37 console.log('[Service Worker] Is working"'); 38 } else { 39 const data = event.data.json(); 40 if(data.hasOwnProperty('data') && typeof data.data === 'object') { 41 console.log('[Service Worker] Push had this data: ', data.data); 42 43 let title = data.data.title; 44 let options = { 45 body: data.data.body, 46 icon: '/favicon/apple-touch-icon-144x144.png', 47 image: data.data.image, 48 data: data.data.click_action, 49 }; 50 51 event.waitUntil(self.registration.showNotification(title, options)); 52 } 53 } 54}); 55 56self.addEventListener('notificationclick', function(event) { 57 try { 58 event.notification.close() 59 60 console.log('[Service Worker] Notification click Received.'); 61 console.log(event.notification); 62 63 if (event.notification.data !== null) { 64 event.waitUntil(clients.openWindow(event.notification.data)) 65 } else { 66 event.waitUntil(clients.openWindow('/')) 67 } 68 } catch (e) {} 69}); 70 71
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.