Skip to content

Is it possible to make a PWA with Service Workers in Brython? #2180

Closed Answered by PierreQuentel
ykonoclast asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for raising this issue, and sorry for the late reply.

I'm afraid using service workers will not be possible with Brython. The specification makes it explicit that the service worker file must be in Javascript.

For web workers, it was possible to convert a Brython script into Javascript, then build a url from a blob containing the JS code and pass it to Worker(url). For service workers, because of security reasons, the constraint is more strict, the url passed to navigator.serviceWorker.register(url) must use the protocol http or https, so I don't think there is a possibility to write the service worker in Python.

As you say, the equivalent of app.js or image-list.js in the service …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ykonoclast
Comment options

Answer selected by ykonoclast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants