79380691

Date: 2025-01-23 10:43:31
Score: 1.5
Natty:
Report link

According to MDN spec https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission_static the possible return values are granted, denied, or default. Your code, despite the MDN example at https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification and others, must act accordingly. (Note this is the SERVICE WORKER version) I suggest and "if not denied" approach. You can also just do the actions regardless of permission and there will be no error.

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: Andrew E