Don't instantiate messaging SDK if service worker is unavailable (Firefox/Private) (#142)

This commit is contained in:
Dan Peterson 2021-10-27 12:34:50 -05:00 committed by GitHub
parent 2922f0f2dc
commit 762bddb158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,8 +11,12 @@ import { firebaseConfig, vapidKey } from '$web/src/firebase-config';
import { addRegistration, removeRegistration, hasRegistration } from '$web/src/fcm-management';
import { browserData } from '$web/src/ua';
let messaging = null;
if ('serviceWorker' in navigator) {
const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app);
messaging = getMessaging(app);
}
const subscriptionMetaData = () => {
const isMobile = window.navigator.userAgentData?.mobile || false;