Editing the .sw file to listen for clicks to close them does not work. Is there a way to make the notification redirect/close on click with this plugin?
This is what my sw looks like now;
importScripts('https://www.gstatic.com/firebasejs/4.1.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/4.1.2/firebase-messaging.js');
if (firebase.apps.length > 0)
firebase.messaging();
self.addEventListener('message', function (event) {
if (firebase.apps.length === 0) {
firebase.initializeApp(event.data);
firebase.messaging();
}
event.ports[0].postMessage(event.data);
});
self.addEventListener('notificationclick', function (event) {
console.log('Clicked');
const clickedNotification = event.notification;
clickedNotification.close();
});
Editing the .sw file to listen for clicks to close them does not work. Is there a way to make the notification redirect/close on click with this plugin? This is what my sw looks like now;