PageSourceSearch

https://www.grameenphone.com/firebase-messaging-sw.js

js grameenphone.com collected 2026-10-01 11:41:35 UTC 2,359 bytes, 75 lines download raw bytes

1importScripts('/firebase-config.js');
2
3if (typeof firebase === 'undefined') {
4  importScripts(
5    'https://webtest.grameenphone.com/sites/all/modules/custom/gp_firebase/js/firebase-app.js',
6  );
7  importScripts(
8    'https://webtest.grameenphone.com/sites/all/modules/custom/gp_firebase/js/firebase-analytics.js',
9  );
10  importScripts(
11    'https://webtest.grameenphone.com/sites/all/modules/custom/gp_firebase/js/firebase-messaging.js',
12  );
13}
14
15firebase.initializeApp(firebaseConfig);
16const messaging = firebase.messaging();
17
18self.addEventListener('push', (event) => {
19  const data = event.data.json();
20  event.waitUntil(
21    self.registration.showNotification(data.notification.title, {
22      image: data.notification.image,
23      body: data.notification.body,
24      icon: data.notification.icon,
25      data: {
26        notifURL: data.notification.click_action,
27      },
28    }),
29  );
30});
31
32self.addEventListener('notificationclick', (event) => {
33  console.log(event);
34  event.waitUntil(clients.openWindow(event?.notification.data.notifURL));
35});
36
37messaging.setBackgroundMessageHandler(function (payload) {
38  var msgID = payload.data.msgID;
39  var openLink = payload.data.openLink;
40  const notificationOption = {
41    image: payload.notification.image,
42    body: payload.notification.body,
43    icon: payload.notification.icon,
44    data: {
45      url: openLink,
46      msgID: msgID,
47    },
48  };
49  var params = 'msg_id=' + msgID + '&status=received&device_type=browser';
50  const analytics = firebase.analytics();
51  return self.registration.showNotification(payload.notification.title, notificationOption);
52});
53
54// The user has clicked on the notification ...
55self.addEventListener('notificationclick', function (event) {
56  event.notification.close();
57  analytics.event.waitUntil(
58    clients
59      .matchAll({
60        type: 'window',
61      })
62      .then(function (clientList) {
63        for (var i = 0; i < clientList.length; i++) {
64          var client = clientList[i];
65          if (client.url == '/' && 'focus' in client) return client.focus();
66        }
67        if (clients.openWindow) {
68          var msgID = event.notification.data.msgID;
69          var params = 'msg_id=' + msgID + '&status=opened&device_type=browser';
70          //updateStatus('opened', params);
71          return clients.openWindow(event.notification.data.url);
72        }
73      }),
74  );
75});

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.