3 ms·
This looks good ! btw I am trying to learn service workers and wanted to check how you have implemented the offline support, but when I checked https://github
by ing33k 10y ago
This looks good !
btw I am trying to learn service workers and wanted to check how you have implemented the offline support, but when I checked
https://github.com/hdjirdeh/angular2-hn/blob/master/src/service-worker.js https://github.com/hdjirdeh/angular2-hn/blob/master/src/serv... it's empty .. am I missing something ?
- dkrvt 10y agoIt's using a library to generate one on the fly: https://github.com/GoogleChrome/sw-precache https://github.com/GoogleChrome/sw-precache
- MrAwesomeSauce 10y agoYep, like dkrvt mentioned I'm using sw-precache to generate the server worker file. The file in my root folder that you're seeing is sort of a placeholder which gets copied to the actual bundle folder that gets deployed (you don't see it in the GitHub repo, you'll need to build the app locally [ng build --prod] to generate it]. sw-precache then lets me run a simple command which sets up the service worker on the fly based on some simple configurations. Here's an excellent article btw that helped me understand how to set up sw-precache with an Angular CLI app (https://coryrylan.com/blog/fast-offline-angular-apps-with-service-workers https://coryrylan.com/blog/fast-offline-angular-apps-with-se...)