google renamed a method, fixing

This commit is contained in:
or-else
2021-02-17 18:36:17 -08:00
parent d904af2d2c
commit b410879ca9
+7 -4
View File
@@ -3,8 +3,6 @@ importScripts('https://cdn.jsdelivr.net/npm/firebase@7.24.0/firebase-app.js');
importScripts('https://cdn.jsdelivr.net/npm/firebase@7.24.0/firebase-messaging.js');
importScripts('firebase-init.js');
firebase.initializeApp(FIREBASE_INIT);
// Basic internationalization.
const i18n = {
'de': {
@@ -44,8 +42,13 @@ self.i18nMessage = function(id) {
return lang[id] || i18n['en'][id] || id;
}
// This method shows the push notifications.
firebase.messaging().setBackgroundMessageHandler((payload) => {
firebase.initializeApp(FIREBASE_INIT);
const fbMessaging = firebase.messaging();
// This method shows the push notifications while the window is in background.
fbMessaging.onBackgroundMessage((payload) => {
console.log("sw got background message", payload.data);
if (payload.data.silent == 'true') {
return;
}