-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Create notifications from service worker so it works on mobile #41177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Preview URLs
Flaws (3)Note! 3 documents with no flaws that don't need to be listed. 🎉 URL:
URL:
External URLs (1)URL:
(comment last updated: 2025-09-19 23:44:20) |
files/en-us/web/api/notifications_api/using_the_notifications_api/index.md
Outdated
Show resolved
Hide resolved
Next, it registers a service worker: | ||
|
||
```js | ||
let swRegistration = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look fine but I haven't tested it. I guess the corresponding changes in https://github.com/mdn/pwa-examples/tree/main/js13kpwa need to be made.
The spec says that notifications created using the constructor are "non-persistent notifications", and notifications created by It would be great to talk about this all explicitly in these docs, and that could also cover the use cases for the different types, and why persistent notifications are not so applicable on mobile. But I suppose that's out of scope for this PR. |
Indeed, and we already have #30931 |
Ah, great. I think that extra context will really help it all make sense. |
Fix #9167. I did not change the other occurrences of
new Notification
because they look like quick examples.