Start work on pwa

This commit is contained in:
Austen Adler 2023-02-28 06:36:33 -05:00
parent 2811900bab
commit da28c92a2b
4 changed files with 2189 additions and 21 deletions

View File

@ -25,6 +25,7 @@
"svelte-check": "^3.0.1",
"typescript": "^4.9.3",
"vite": "^4.1.4",
"vite-plugin-pwa": "^0.14.4",
"vite-plugin-wasm-pack": "^0.1.12"
},
"type": "module"

View File

@ -6,8 +6,7 @@
let mapElement;
let map;
let wasm;
let lat = '';
let lon = '';
let latlng = { lat: '', lng: '' };
let addr = '';
onMount(async () => {
@ -27,9 +26,8 @@
map.on('click', (e) => {
try {
lat = '' + e.latlng.lat;
lon = '' + e.latlng.lng;
addr = address_from_lat_lon(e.latlng.lat, e.latlng.lng);
latlng = e.latlng;
addr = address_from_lat_lon(latlng.lat, latlng.lng);
popup.setLatLng(e.latlng).setContent(`You clicked at ${addr}`).openOn(map);
} catch (err) {
console.error(err);
@ -60,7 +58,7 @@
{/await}
</p>
<p>Current cursor: {addr} => ({lat}, {lon})</p>
<p>Current cursor: {addr} => ({latlng.lat}, {latlng.lng})</p>
<main>
<div bind:this={mapElement} />

View File

@ -1,7 +1,8 @@
import { sveltekit } from '@sveltejs/kit/vite';
import wasmPack from 'vite-plugin-wasm-pack';
import { defineConfig } from 'vite';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [sveltekit(), wasmPack('../this_algorithm-wasm/')]
plugins: [sveltekit(), wasmPack('../this_algorithm-wasm/'), VitePWA()]
});

File diff suppressed because it is too large Load Diff