Download assets/global/js/firebase/firebase-messaging-sw.js from pnacorp/codeplus: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/pnacorp/codeplus/resolve/main/assets/global/js/firebase/firebase-messaging-sw.js
- Command line
-
hf download hf://pnacorp/codeplus/assets/global/js/firebase/firebase-messaging-sw.js
-
curl -L -o firebase-messaging-sw.js https://huggingface.co/pnacorp/codeplus/resolve/main/assets/global/js/firebase/firebase-messaging-sw.js
1.1 kB
| /* | |
| Give the service worker access to Firebase Messaging. | |
| Note that you can only use Firebase Messaging here, other Firebase libraries are not available in the service worker. | |
| */ | |
| importScripts('firebase-app.js'); | |
| importScripts('firebase-messaging.js'); | |
| importScripts('configs.js'); | |
| /* | |
| Initialize the Firebase app in the service worker by passing in the messagingSenderId. | |
| * New configuration for app@pulseservice.com | |
| */ | |
| firebase.initializeApp(firebaseConfig); | |
| /* | |
| Retrieve an instance of Firebase Messaging so that it can handle background messages. | |
| */ | |
| const messaging = firebase.messaging(); | |
| messaging.setBackgroundMessageHandler(function(payload) { | |
| console.log( | |
| "[firebase-messaging-sw.js] Received background message ", | |
| payload, | |
| ); | |
| /* Customize notification here */ | |
| const notificationTitle = "Background Message Title"; | |
| const notificationOptions = { | |
| body: "Background Message body.", | |
| icon: "/firebase-logo.png", | |
| }; | |
| return self.registration.showNotification( | |
| notificationTitle, | |
| notificationOptions, | |
| ); | |
| }); |