Skip to content

Commit 486e5c6

Browse files
authored
Update gstatic url for v8 example (#325)
1 parent 73a4f0b commit 486e5c6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

messaging/service-worker.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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

Comments
 (0)