tasq/web/firebase-messaging-sw.js

28 lines
1.1 KiB
JavaScript

importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-app-compat.js');
importScripts('https://www.gstatic.com/firebasejs/9.22.2/firebase-messaging-compat.js');
// This file must be served with "Content-Type: application/javascript" and
// placed at the root of the `web/` build output. Flutter web does not copy it
// automatically, so ensure you add a manual copy step to your build script or
// include it in `web/` before building.
firebase.initializeApp({
// values must match `firebase_options.dart` generated by `flutterfire`
apiKey: 'AIzaSyBKGSaHYiqpZvbEgsvJJY45soiIkV6MV3M',
appId: '1:173359574734:web:f894a6b43a443e902baa9f',
messagingSenderId: '173359574734',
projectId: 'tasq-17fb3',
authDomain: 'tasq-17fb3.firebaseapp.com',
storageBucket: 'tasq-17fb3.firebasestorage.app',
});
const messaging = firebase.messaging();
messaging.onBackgroundMessage(function(payload) {
// display a notification using data in the payload
self.registration.showNotification(payload.notification.title, {
body: payload.notification.body,
data: payload.data,
});
});