bukopin-redemption-client-r.../public/firebase-messaging-sw.js
Rifqy Zacky Ariadhy 1a000700e6 Initial commit
2019-01-02 18:39:53 +07:00

39 lines
1.3 KiB
JavaScript

/**
* Created by 322 on 01/04/2017.
*/
importScripts('https://www.gstatic.com/firebasejs/4.6.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.6.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({
apiKey: "AIzaSyD1D-eyFDVx2aWJCbPGIYFEHP68xHdi3ZY",
authDomain: "marketplace-373ce.firebaseapp.com",
databaseURL: "https://marketplace-373ce.firebaseio.com",
projectId: "marketplace-373ce",
storageBucket: "marketplace-373ce.appspot.com",
messagingSenderId: "780734330428"
});
// Retrieve an instance of Firebase Messaging so that it can handle background
// messages.
const messaging = firebase.messaging();
// messaging.onMessage(function(payload) {
// console.log("Message received. ", payload);
// const notificationTitle = payload.title;
// const notificationOptions = {
// body: payload.body,
// icon: payload.icon
// };
// });
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'
};
});