Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,t)=>{const c=e||("document"in self?document.currentScript.src:"")||location.href;if(s[c])return;let r={};const o=e=>i(e,c),a={module:{uri:c},exports:r,require:o};s[c]=Promise.all(n.map(e=>a[e]||o(e))).then(e=>(t(...e),r))}}define(["./workbox-1d305bb8"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"manifest.webmanifest",revision:"90bba3b1e58044451de0bb5ba407f418"},{url:"index.html",revision:"d6eecdbc0aac35ef5e1a06a075a90183"},{url:"icons/icon-512.png",revision:"81e7312ad6a641949a2c5140d3716895"},{url:"icons/icon-192.png",revision:"b9ecccceab7cf3ec7d7a02fd45277247"},{url:"data/shelters.json",revision:"f28e872a285d4647cd1ba9ea98e0b06c"},{url:"assets/index-Db4vftzp.js",revision:"3be3eacc39fbc435514f11a4f412e97d"},{url:"assets/index-Cki23tZT.css",revision:"e11597b4bbc77264a7ef0e725bcac53a"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute(/^https:\/\/[abc]\.tile\.openstreetmap\.org\/.*/,new e.CacheFirst({cacheName:"osm-tiles",plugins:[new e.ExpirationPlugin({maxEntries:5e3,maxAgeSeconds:2592e3}),new e.CacheableResponsePlugin({statuses:[0,200]})]}),"GET")});
|