From 547ad6381273c7c4ffb996fa2ee929a3ca41907c Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Tue, 1 Dec 2020 11:52:10 +0000 Subject: [PATCH] Refactor FCM service worker --- src/firebase-messaging-sw.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/firebase-messaging-sw.js diff --git a/src/firebase-messaging-sw.js b/src/firebase-messaging-sw.js new file mode 100644 index 0000000..7f35fc6 --- /dev/null +++ b/src/firebase-messaging-sw.js @@ -0,0 +1,17 @@ +import { environment } from "./environments/environment"; + +importScripts('https://www.gstatic.com/firebasejs/8.0.0/firebase-app.js'); +importScripts('https://www.gstatic.com/firebasejs/8.0.0/firebase-messaging.js'); + +firebase.initializeApp({ + apiKey: environment.firebase.apiKey, + authDomain: environment.firebase.authDomain, + databaseURL: environment.firebase.databaseURL, + projectId: environment.firebase.projectId, + storageBucket: environment.firebase.storageBucket, + messagingSenderId: environment.firebase.messagingSenderId, + appId: environment.firebase.appId, + measurementId: environment.firebase.measurementId +}); + +const messaging = firebase.messaging();