Skip to content

Instantly share code, notes, and snippets.

@MaBbKhawaja
Created September 6, 2020 19:01
Show Gist options
  • Save MaBbKhawaja/f7b5f00b70b4f8c76f15c6161e7c88d8 to your computer and use it in GitHub Desktop.
Save MaBbKhawaja/f7b5f00b70b4f8c76f15c6161e7c88d8 to your computer and use it in GitHub Desktop.
import * as firebase from 'firebase/app';
import 'firebase/messaging'
// // Initialize Firebase
firebase.initializeApp({
'messagingSenderId': '744798928283'
});
navigator.serviceWorker.register('firebase-messaging-sw.js', {scope: "firebase-cloud-messaging-push-scope"})
.then((registration) => {
const messaging = firebase.messaging();
messaging.useServiceWorker(registration);
}).catch(err => {
console.log(err)
})
// fiebase configs end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment