You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.1 KiB

1 year ago
  1. importScripts('https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js');
  2. importScripts('https://www.gstatic.com/firebasejs/8.10.1/firebase-messaging.js');
  3. firebase.initializeApp({
  4. apiKey: "AIzaSyAxAkj3yS3nY3i1qMmANohaOqKZBHNeqV4",
  5. authDomain: "webapp-9ec9c.firebaseapp.com",
  6. projectId: "webapp-9ec9c",
  7. storageBucket: "webapp-9ec9c.appspot.com",
  8. messagingSenderId: "363941055701",
  9. appId: "1:363941055701:web:dde5972e1019d968e4e65c",
  10. measurementId: "G-F4RT64WY6M"
  11. });
  12. // Retrieve an instance of Firebase Messaging so that it can handle background
  13. // messages.
  14. const messaging = firebase.messaging();
  15. messaging.onBackgroundMessage((payload) => {
  16. console.log(
  17. '[firebase-messaging-sw.js] Received background message ',
  18. payload
  19. );
  20. // Customize notification here
  21. //const notificationTitle = 'Background Message Title';
  22. //const notificationOptions = {
  23. // body: 'Background Message body.',
  24. // icon: '/firebase-logo.png'
  25. //};
  26. //self.registration.showNotification(notificationTitle, notificationOptions);
  27. });