1importScripts('https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js'); 2importScripts('https://www.gstatic.com/firebasejs/8.10.1/firebase-messaging.js'); 3importScripts('./firebase-consts.js'); 4 5firebase.initializeApp(config); 6 7const messaging = firebase.messaging(); 8 9messaging.onBackgroundMessage((payload) => { 10 const data = payload.data 11 if (data.title != null && data.body != null) { 12 const actions = [] 13 const category = data.click_action 14 if (category != null && category === 'link_category') { 15 actions.push({action: '2', title: 'Open Link'}) 16 } 17 18 let notifData = {} 19 const itemId = data.itemId 20 if (itemId != null) { 21 const base64 = self.btoa(itemId) 22 const host = self.location.origin + '/dashboard/' + base64 23 notifData = { url: host } 24 } 25 this.registration.showNotification(data.title, { body: data.body, actions, data: notifData }) 26 } 27}) 28 29self.addEventListener('notificationclick', function(event) { 30 31 const body = event.notification.body 32 const url = event.notification.data.url 33 34 if (event.action === '2') { 35 clients.openWindow(body) 36 } 37 else { 38 if (url != null) { 39 clients.openWindow(url) 40 } 41 } 42 event.notification.close(); 43}, false)
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.