google renamed a method, fixing
This commit is contained in:
+7
-4
@@ -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('https://cdn.jsdelivr.net/npm/firebase@7.24.0/firebase-messaging.js');
|
||||||
importScripts('firebase-init.js');
|
importScripts('firebase-init.js');
|
||||||
|
|
||||||
firebase.initializeApp(FIREBASE_INIT);
|
|
||||||
|
|
||||||
// Basic internationalization.
|
// Basic internationalization.
|
||||||
const i18n = {
|
const i18n = {
|
||||||
'de': {
|
'de': {
|
||||||
@@ -44,8 +42,13 @@ self.i18nMessage = function(id) {
|
|||||||
return lang[id] || i18n['en'][id] || id;
|
return lang[id] || i18n['en'][id] || id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method shows the push notifications.
|
firebase.initializeApp(FIREBASE_INIT);
|
||||||
firebase.messaging().setBackgroundMessageHandler((payload) => {
|
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') {
|
if (payload.data.silent == 'true') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user