1/** 2 * Firebase Cloud Messaging Service Worker 3 * 4 * NOTE: This file is _very magic_. The name itself needs to be exactly 5 * `firebase-messaging-sw.js` and it needs to be in the root of the public 6 * directory. It gets loaded automatically by the firebase messaging code 7 * when it's initialized in our angular app. 8 * 9 * Even though we've updated our app to use the new firebase v9 SDK, we still need 10 * to use the v8-style (compat) code here, since we don't use a bundler for this. 11 * Probably we could set up a custom bundle step for this, but we should not do that. 12 * (see https://github.com/firebase/firebase-js-sdk/issues/5732. It's unfortunately 13 * the best documentation available.) 14 * 15 * When we add the angular service worker (ngsw) to our app (again), we need to change 16 * this anyway. 17 */ 18importScripts( 19 "https://www.gstatic.com/firebasejs/10.0.0/firebase-app-compat.js", 20); 21importScripts( 22 "https://www.gstatic.com/firebasejs/10.0.0/firebase-messaging-compat.js", 23); 24// Initialize the Firebase app in the service worker by passing in the 25// required parameters 26// see https://firebase.google.com/support/release-notes/js#version_700_-_september_26_2019 27// TODO: Read different configs per environment 28firebase.initializeApp({ 29 projectId: "hazu-ch", 30 apiKey: "AIzaSyDhA3pxfshRA9gTTdcKmVyQ3xGwz3lhXl0", 31 appId: "1:457097740900:web:db8b8ffda4e1684f24d571", 32 messagingSenderId: "457097740900", 33}); 34 35// Retrieve an instance of Firebase Messaging so that it can handle background 36// messages. 37let messaging = null; 38 39if (firebase.messaging.isSupported()) { 40 console.log("Firebase messaging is supported"); 41 messaging = firebase.messaging(); 42}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.