Create Service Worker
Will allow site to load quicker and work offline with stored data when installed as a PWA.
Caching Strategy:
- Map tiles (keep for 30 days)
- historical NBN info (keep indefinitely)
- main/current NBN info (fetch every time or maybe keep for a few hrs max)
- JavaScript files and others (30 days?)
https://stackoverflow.com/questions/46036897/best-practices-for-detecting-offline-state-in-a-service-worker https://developer.chrome.com/docs/workbox/caching-strategies-overview/
Got this for now: https://github.com/LukePrior/nbn-upgrade-map/blob/main/site/serviceworker.js
Ok hopefully that will work ok, still needs an update to periodically purge caches if nearing storage limits
This might help with https://github.com/LukePrior/nbn-upgrade-map/issues/309
https://github.com/LukePrior/nbn-upgrade-map/issues/309#issuecomment-1822011979