Don't instantiate messaging SDK if service worker is unavailable (Firefox/Private) (#142)
This commit is contained in:
parent
2922f0f2dc
commit
762bddb158
1 changed files with 6 additions and 2 deletions
|
@ -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';
|
||||
|
||||
const app = initializeApp(firebaseConfig);
|
||||
const messaging = getMessaging(app);
|
||||
let messaging = null;
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
const app = initializeApp(firebaseConfig);
|
||||
messaging = getMessaging(app);
|
||||
}
|
||||
|
||||
const subscriptionMetaData = () => {
|
||||
const isMobile = window.navigator.userAgentData?.mobile || false;
|
||||
|
|
Loading…
Reference in a new issue