update
This commit is contained in:
parent
01cd575ec8
commit
a5e4c7de23
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
|
||||
importScripts("https://www.gstatic.com/firebasejs/8.2.4/firebase-app.js");
|
||||
importScripts("https://www.gstatic.com/firebasejs/8.2.4/firebase-messaging.js");
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: "AIzaSyBz8TPvKl7qk6XIuTnYrO-ZwcxJJ-Qqo6w",
|
||||
projectId: "iralex",
|
||||
messagingSenderId: "986858475219",
|
||||
appId: "1:986858475219:web:196b303393db1e234e4e26",
|
||||
};
|
||||
|
||||
firebase.initializeApp(firebaseConfig);
|
||||
|
||||
self.addEventListener('push', function (event) {
|
||||
let data = event.data.json();
|
||||
const title = data.notification.title;
|
||||
const body = data.notification.body;
|
||||
const options = {
|
||||
body : body,
|
||||
icon :'/iralex-favicon.png'
|
||||
};
|
||||
event.waitUntil(self.registration.showNotification(title, options));
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', function (event) {
|
||||
console.log(event.notification, 'event.notification')
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclose', function (event) {
|
||||
console.log(event, 'eventeventeventeventeventeventeventeventevent')
|
||||
});
|
||||
Loading…
Reference in New Issue