/* // 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('https://www.gstatic.com/firebasejs/7.23.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.3.2/firebase-messaging.js');
/*

Initialize the Firebase app in the service worker by passing in the messagingSenderId.
*/

importScripts('https://www.gstatic.com/firebasejs/8.3.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.3.2/firebase-messaging.js');


firebase.initializeApp({
    apiKey: "AIzaSyDidYLaBERvmHW_7AO0FxSmTcfhwoLXlh8",
    authDomain: "engi-2cd38.firebaseapp.com",
    projectId: "engi-2cd38",
    storageBucket: "engi-2cd38.appspot.com",
    messagingSenderId: "223975475519",
    appId: "1:223975475519:web:727ca2417da513fdbbeb8a",
    measurementId: "G-74WELCVY1F"
});

// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function({data:{title,body,icon}}) {
    return self.registration.showNotification(title,{body,icon});
});

messaging.onMessage((payload) => {
    console.log('Message received. ', payload);
  });


