Skip to content
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

Caching service worker #686

Merged
merged 12 commits into from
Jun 23, 2022
Merged

Conversation

martinRenou
Copy link
Member

@martinRenou martinRenou commented Jun 22, 2022

References

Port changes from #137 into the new service worker

Closes #137

Code changes

Add caching logic to the service worker, for offline support.

@github-actions
Copy link
Contributor

lite-badge 👈 Try it on ReadTheDocs

@martinRenou martinRenou added the enhancement New feature or request label Jun 22, 2022
@jtpio jtpio added this to the 0.1.0 milestone Jun 22, 2022
app/lab/manifest.webmanifest Outdated Show resolved Hide resolved
@martinRenou
Copy link
Member Author

martinRenou commented Jun 23, 2022

For some reason my browser is not able to find the manifest on my PR Works now! I was missing manifest links in the HTML

@martinRenou martinRenou marked this pull request as ready for review June 23, 2022 13:35
@martinRenou martinRenou requested a review from jtpio June 23, 2022 13:35
@jtpio
Copy link
Member

jtpio commented Jun 23, 2022

Showing up nicely with Chromium 103:

image

@martinRenou
Copy link
Member Author

Once installed it shows up nicely in the Gnome UI:

litedesktop.mp4

@martinRenou martinRenou marked this pull request as draft June 23, 2022 14:05
@bollwyvl
Copy link
Collaborator

Are the multiple manifests, etc. necessary? Could we do it with a single root-level one some kind of preference for which UI? shortcuts?

If it does need to be that way: is repl going to get one as well? It seems like a pretty big win for certain situations, though I don't know how it would play vs being embedded within a larger application: frankly seems like a pretty useful function for a sphinx theme to have, anyway.

@martinRenou
Copy link
Member Author

Could we do it with a single root-level one some kind of preference for which UI? shortcuts?

Oh I didn't know about shortcuts, sweet! I'll try that.

@martinRenou
Copy link
Member Author

I was thinking maybe the retro one doesn't make sense anyway? Because it's not single page, or maybe there is a feature to keep open tabs in the same window?

@martinRenou
Copy link
Member Author

Unfortunately there doesn't seem to be a way to make tabbed applications for now. w3c/manifest#737 might be the right issue for that. So an app for retrolab might not really be possible. Well it's possible but it's not nice, when opening a Notebook from the tree, it opens the tab in the browser, not in the "app".

@martinRenou
Copy link
Member Author

Here with shortcuts:

apps.mp4

looks quite nice :D (the screen recording was a bit laggy but it works nicely)

@martinRenou martinRenou marked this pull request as ready for review June 23, 2022 14:55
app/manifest.webmanifest Outdated Show resolved Hide resolved
@jtpio
Copy link
Member

jtpio commented Jun 23, 2022

Just tried again with the latest after uninstalling the previous app, and this time the icon does not seem to be displayed in the Gnome launcher:

image

@martinRenou
Copy link
Member Author

That's odd, I can still see it:
liteapp

@jtpio
Copy link
Member

jtpio commented Jun 23, 2022

OK I just reinstalled it and restarted the Gnome Shell and it is showing up correctly now:

image

@jtpio
Copy link
Member

jtpio commented Jun 23, 2022

It's also cool to see many resources served from the ServiceWorker, for example when starting a new kernel:

image

Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jtpio jtpio merged commit 33d8bbf into jupyterlite:main Jun 23, 2022
@jtpio jtpio mentioned this pull request Jun 23, 2022
@martinRenou martinRenou deleted the caching_service_worker branch June 24, 2022 07:24
@eugene-f02
Copy link

eugene-f02 commented Oct 27, 2022

@jtpio @martinRenou Is there a way to configure jlite to disable ServiceWorker altogether or to disable it for requests made to certain domains? I have a custom extension that makes requests to external service to fetch some data and I don't want it to be cached

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants