PageSourceSearch

https://dangky.sandbox.com.vn/firebase-messaging-sw.js

js sandbox.com.vn collected 2026-09-24 14:29:41 UTC 2,110 bytes, 58 lines download raw bytes

1importScripts("/assets/lib/firebase-app.js");
2importScripts("/assets/lib/firebase-messaging.js");
3firebase.initializeApp({
4  apiKey: "AIzaSyD0sOjA_OXgwvmakdJiFQb6ZKaSr3HBQwA",
5  authDomain: "sandboxvn-staging-fullbooking.firebaseapp.com",
6  projectId: "sandboxvn-staging-fullbooking",
7  storageBucket: "sandboxvn-staging-fullbooking.appspot.com",
8  messagingSenderId: "258312303357",
9  appId: "1:258312303357:web:cfec92c345867733200494",
10  measurementId: "G-7RVDNCJXB6"
11});
12
13const messaging = firebase.messaging();
14// messaging.onBackgroundMessage((payload) => {
15//   let notiInfo = JSON.parse(payload.data.notificationInfo);
16//   const notificationTitle = notiInfo.message.title;
17//   const notificationOptions = {
18//     body: notiInfo.message.content,
19//     icon: "./assets/icons/logo-ecopark.png",
20//     image: notiInfo.message.image,
21//     data: {
22//       url: notiInfo.message.link,
23//     }, 
24//   };
25//   self.registration?.showNotification(notificationTitle, notificationOptions);
26
27//   self.addEventListener("notificationclick", (event) => {
28//     if (event?.notification?.data?.url) {
29//       event.waitUntil(clients.openWindow(event.notification.data.url));
30//     } else
31//       event.waitUntil(
32//         clients.openWindow("https://staging.chienbinhecopark.com/")
33//       );
34//   });
35// });
36
37messaging.onBackgroundMessage((payload) => {
38 let notiInfo = {};
39  try {
40    notiInfo = JSON.parse(payload.data.notificationInfo);
41  } catch (err) {
42    console.error("Không parse được notificationInfo:", err);
43  }
44
45  const notificationTitle = notiInfo?.message?.title || "Thông báo";
46  const notificationBody = notiInfo?.message?.content || "Bạn có một thông báo mới.";
47
48  const notificationOptions = {
49    body: notificationBody,
50    icon: "/assets/icons/logo-ecopark.png", // đảm bảo icon nằm đúng path gốc
51    image: notiInfo?.message?.image || undefined,
52    data: {
53      url: notiInfo?.message?.link || "/"
54    }
55  };
56
57  self.registration?.showNotification(notificationTitle, notificationOptions);
58});

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.