-
Notifications
You must be signed in to change notification settings - Fork 153
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
Add a service-worker example #523
Conversation
92ea70e
to
4986d0f
Compare
Could we remove
One of the big reasons why users migrate from JS frameworks to Seed are too complicated and unreliable JS tools, we shouldn't disappoint them. |
Sure, no problem. I'll take both workbox-cli and yarn out. Out of curiosity, |
The same result when I run the command directly from the example directory. The same for the the task Also there are some commands like Lines 276 to 294 in 4387219
I'll do another code review round once |
Thanks for sharing. I've removed the package.json, yarn lock file, workbox-cli etc and will push again shortly. |
Btw |
Yeah I figured it made sense to clean up the
|
Regarding the firefox error I believe they want a user gesture before subscribing so I'm adding that now. Should have another push shortly. |
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.
I've added some review comments.
Also please update CHANGELOG.md
(I think there is a line "Added examples ..." - you can append your example).
And examples/README.md
.
Let me know once you are ready for the next round 🙂
off-topic / BTW:
I totally agree!! 👍 |
Thanks for the thorough review! I'm going through the changes now. |
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.
Another round finished!
Major problems should be eliminated once all comments are resolved. In the next round I'll focus on code refactoring / best practices.
Some issues not mentioned in discussions:
CHANGELOG.md
andexamples/README.md
aren't updated if I'm not wrong (see my previous comment attached to "Request changes" comment.)- It would be nice to add a button "Clear cache" because it's a bit annoying when
localhost
constantly returns the cached example even if you run other examples.
Thanks for the additional review. I'll address each item once I get off work. |
I've addressed all by one comment (moving the initial call to the |
f88658e
to
13e1e6c
Compare
Blocked by johnsonw#1 |
372f233
to
d1599b8
Compare
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.
Another round finished. Looks pretty good, everything works. I was focusing on style, consistency and cross-platform support. Good job!
Please squash commits when you are done. I rebase on master
and commits like Fixups
and more fixups
would look ugly in the Seed commit history and it wouldn't help during debugging.
d1599b8
to
13349cb
Compare
Service worker can be integrated into the seed framework. This example demonstrates the following: 1. Use service worker to cache all assets (including the generated wasm file). 2. Register the service worker. 3. If the service worker is not yet activated, an even listener will be registered, waiting for the state to reach "activated". 4. When the state reaches "activated", the Notification object will request permission for notifications. 5. If permission is granted, the PushManager will subscribe to the service using an example vapid key. 6. Finally, a PushSubscription will be returned, containing the information that can be passed to a notifcation back-end server. Signed-off-by: johnsonw <william.c1.johnson@gmail.com>
13349cb
to
fe5fe14
Compare
Service worker can be integrated into the seed framework. This example
demonstrates the following:
state to reach "activated".
notifcation back-end server.
Signed-off-by: johnsonw william.c1.johnson@gmail.com