PageSourceSearch

https://www.binge.nl/firebase-messaging-sw.js

js binge.nl collected 2026-09-24 11:35:27 UTC 1,625 bytes, 46 lines download raw bytes

1/**
2 * Firebase Messaging Service Worker
3 * This file handles background push notifications
4 * Place this file in your public root directory as: /firebase-messaging-sw.js
5 */
6
7importScripts('https://www.gstatic.com/firebasejs/12.8.0/firebase-app-compat.js');
8importScripts('https://www.gstatic.com/firebasejs/12.8.0/firebase-messaging-compat.js');
9
10// Initialize Firebase in the service worker
11firebase.initializeApp({
12    apiKey: "AIzaSyDswLU8JzawFv7K3yN8LG_GjzGAw0l6AGs",
13    authDomain: "binge-prod-web.firebaseapp.com",
14    projectId: "binge-prod-web",
15    storageBucket: "binge-prod-web.firebasestorage.app",
16    messagingSenderId: "548395530118",
17    appId: "1:548395530118:web:e1c31101dc97a0dfe01e07"
18});
19
20const messaging = firebase.messaging();
21
22// Handle background messages
23messaging.onBackgroundMessage((payload) => {
24    const notificationTitle = payload.data.title || 'New Notification';
25    const notificationOptions = {
26        body: payload.data.body || '',
27        icon: 'https://www.binge.nl/static/img/logo/b_with_text.png',
28        image: payload.data.image || '',
29        data: {
30            permalink: payload.data.permalink || '/'
31        }
32    };
33
34    return self.registration.showNotification(notificationTitle, notificationOptions);
35});
36
37// Handle notification clicks
38self.addEventListener('notificationclick', function(event) {
39    event.notification.close(); // Close the notification
40
41    // Open the URL from the notification's data
42    if (event.notification.data && event.notification.data.permalink) {
43        clients.openWindow(event.notification.data.permalink); // Open the URL
44    }
45});
46

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.