3 ms·
The service worker thing is a weird amount of boilerplate. Every time I go back to making a PWA, I skip through 10 search results explaining what a service work
by iforgot22 2y ago
The service worker thing is a weird amount of boilerplate. Every time I go back to making a PWA, I skip through 10 search results explaining what a service worker is (idc) until I just find whatever .js code I have to copy. And it's not some trivial one-liner.
I get that in theory a PWA can do offline stuff and whatever, but 99% of the time someone is only making a PWA to make the app installable on a phone home screen.
- giancarlostoro 2y agoIt is not a trivial one liner no, but you need 3 events implemented in your service-worker file, then in your main.js file you register it. Service workers are just JavaScript that runs in the background in their own process in a browser. Could think of them as separate threads. Anyway, all of that can be done in less than 20 lines of JS? I consider it simple compared to people building React apps and making the process more complicated than it needs to be just to build a PWA. I was able to build a PWA out of a bootstrap HTML5 web app, with minimal JS for REST calls and ag-grid population.