Use self.addEventListener('notificationclick', (event) => {} to listen to background notification clicks.
For example:
firebase-messaging-sw.js
...self.addEventListener('notificationclick',(event)=>{console.log({notificationclick:event})if(event.action){clients.openWindow(event.action)}else{// Open tv pageclients.openWindow(origin+'/tv')}event.notification.close()})
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi @danielfoga
Use
self.addEventListener('notificationclick', (event) => {}to listen to background notification clicks.For example:
firebase-messaging-sw.js