1- import firebase from " firebase/app" ;
2- import " firebase/messaging" ;
1+ import firebase from ' firebase/app' ;
2+ import ' firebase/messaging' ;
33
44// See: https://github.com/microsoft/TypeScript/issues/14877
55/** @type {ServiceWorkerGlobalScope } */
@@ -10,8 +10,8 @@ function initInSw() {
1010 // Give the service worker access to Firebase Messaging.
1111 // Note that you can only use Firebase Messaging here. Other Firebase libraries
1212 // are not available in the service worker.
13- importScripts ( 'https://www.gstatic.com/firebasejs/9.2.0 /firebase-app.js' ) ;
14- importScripts ( 'https://www.gstatic.com/firebasejs/9.2.0 /firebase-messaging.js' ) ;
13+ importScripts ( 'https://www.gstatic.com/firebasejs/8.10.1 /firebase-app.js' ) ;
14+ importScripts ( 'https://www.gstatic.com/firebasejs/8.10.1 /firebase-messaging.js' ) ;
1515
1616 // Initialize the Firebase app in the service worker by passing in
1717 // your app's Firebase config object.
@@ -38,16 +38,18 @@ function onBackgroundMessage() {
3838
3939 // [START messaging_on_background_message]
4040 messaging . onBackgroundMessage ( ( payload ) => {
41- console . log ( '[firebase-messaging-sw.js] Received background message ' , payload ) ;
41+ console . log (
42+ '[firebase-messaging-sw.js] Received background message ' ,
43+ payload
44+ ) ;
4245 // Customize notification here
4346 const notificationTitle = 'Background Message Title' ;
4447 const notificationOptions = {
4548 body : 'Background Message body.' ,
4649 icon : '/firebase-logo.png'
4750 } ;
48-
49- self . registration . showNotification ( notificationTitle ,
50- notificationOptions ) ;
51+
52+ self . registration . showNotification ( notificationTitle , notificationOptions ) ;
5153 } ) ;
5254 // [END messaging_on_background_message]
5355}
0 commit comments