djirdehh / crypto_vue

💠 A Vue.js based real-time dashboard of the top 10 cryptocurrencies
https://www.cryptovue.com/
351 stars 53 forks source link

add service worker registration to index.html #2

Closed housseindjirdeh closed 7 years ago

housseindjirdeh commented 7 years ago

You're using Google's sw-precache library to generate a service worker file on the fly, which is awesome 🙌 🎉

Although the service worker gets generated right to the deployment folder, the app doesn't try looking for the file and register it. This snippet will check if the browser allows service worker usage and if so, register it so the app can work offline.

Also added a noscript tag to pop a message if the user has JS disabled - a better solution for this would be relying on server side rendering some of the content so at least we can have graceful degradation for users without JS (but that's a discussion for a different time - need to outweigh the effort/benefits of course :)

djirdehh commented 7 years ago

Good stuff man. I was trying to get the Service Worker listener to fire within the root build component (main.js) but it didn't seem to cache then.