-
Notifications
You must be signed in to change notification settings - Fork 11
/
sw.js
26 lines (21 loc) · 972 Bytes
/
sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* global importScripts, firebase */
importScripts('https://www.gstatic.com/firebasejs/7.5.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/7.5.0/firebase-messaging.js');
var firebaseConfig = {
apiKey: "AIzaSyBJguGFPPZXozdkPVpBZNbGMVJ_LTOYuQA",
authDomain: "jcubic-1500107003772.firebaseapp.com",
databaseURL: "https://jcubic-1500107003772.firebaseio.com",
projectId: "jcubic-1500107003772",
storageBucket: "jcubic-1500107003772.appspot.com",
messagingSenderId: "1005897028349",
appId: "1:1005897028349:web:f9f90304397535db17e494"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function(payload) {
const {title, ...options} = payload.notification;
return self.registration.showNotification(title, options);
});
self.addEventListener('install', self.skipWaiting);
self.addEventListener('activate', self.skipWaiting);