1importScripts('https://www.gstatic.com/firebasejs/12.4.0/firebase-app-compat.js'); 2importScripts('https://www.gstatic.com/firebasejs/12.4.0/firebase-messaging-compat.js'); 3importScripts('./firebase-config.js'); 4 5self.addEventListener("notificationclick", (e) => { 6 e.notification.close(); 7 8 const baseUrl = self.location.origin; 9 const path = e.notification.data?.url ?? e.notification.data?.FCM_MSG?.data?.url; 10 11 if (!baseUrl || !path) { 12 return 13 } 14 15 const urlToOpen = new URL(path, baseUrl).href; 16 17 e.waitUntil( 18 clients.matchAll({ type: "window" }).then((clientsArr) => { 19 const windowToFocus = clientsArr.find( 20 (windowClient) => windowClient.url === urlToOpen, 21 ); 22 if (windowToFocus) { 23 windowToFocus.focus(); 24 } else { 25 clients 26 .openWindow(urlToOpen) 27 .then((windowClient) => (windowClient ? windowClient.focus() : null)); 28 } 29 }), 30 ); 31}); 32 33firebase.initializeApp({ 34 apiKey: NEXT_PUBLIC_FIREBASE_API_KEY, 35 authDomain: NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN, 36 projectId: NEXT_PUBLIC_FIREBASE_PROJECT_ID, 37 storageBucket: NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET, 38 messagingSenderId: NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID, 39 appId: NEXT_PUBLIC_FIREBASE_APP_ID, 40 measurementId: NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID 41}); 42 43const messaging = firebase.messaging();
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.