Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // public/
- importScripts('https://www.gstatic.com/firebasejs/8.2.3/firebase-app.js');
- importScripts('https://www.gstatic.com/firebasejs/8.2.3/firebase-messaging.js');
- // Set Firebase configuration, once available
- self.addEventListener('fetch', () => {
- const urlParams = new URLSearchParams(location.search);
- console.log('url', urlParams);
- self.firebaseConfig = Object.fromEntries(urlParams);
- });
- // "Default" Firebase configuration (prevents errors)
- const defaultConfig = {
- apiKey: true,
- projectId: true,
- messagingSenderId: true,
- appId: true,
- };
- // Initialize Firebase app
- firebase.initializeApp(self.firebaseConfig || defaultConfig);
- const messaging = firebase.messaging();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement