Start work on pwa
This commit is contained in:
parent
2811900bab
commit
da28c92a2b
@ -25,6 +25,7 @@
|
|||||||
"svelte-check": "^3.0.1",
|
"svelte-check": "^3.0.1",
|
||||||
"typescript": "^4.9.3",
|
"typescript": "^4.9.3",
|
||||||
"vite": "^4.1.4",
|
"vite": "^4.1.4",
|
||||||
|
"vite-plugin-pwa": "^0.14.4",
|
||||||
"vite-plugin-wasm-pack": "^0.1.12"
|
"vite-plugin-wasm-pack": "^0.1.12"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module"
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
let mapElement;
|
let mapElement;
|
||||||
let map;
|
let map;
|
||||||
let wasm;
|
let wasm;
|
||||||
let lat = '';
|
let latlng = { lat: '', lng: '' };
|
||||||
let lon = '';
|
|
||||||
let addr = '';
|
let addr = '';
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
@ -27,9 +26,8 @@
|
|||||||
|
|
||||||
map.on('click', (e) => {
|
map.on('click', (e) => {
|
||||||
try {
|
try {
|
||||||
lat = '' + e.latlng.lat;
|
latlng = e.latlng;
|
||||||
lon = '' + e.latlng.lng;
|
addr = address_from_lat_lon(latlng.lat, latlng.lng);
|
||||||
addr = address_from_lat_lon(e.latlng.lat, e.latlng.lng);
|
|
||||||
popup.setLatLng(e.latlng).setContent(`You clicked at ${addr}`).openOn(map);
|
popup.setLatLng(e.latlng).setContent(`You clicked at ${addr}`).openOn(map);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@ -60,7 +58,7 @@
|
|||||||
{/await}
|
{/await}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Current cursor: {addr} => ({lat}, {lon})</p>
|
<p>Current cursor: {addr} => ({latlng.lat}, {latlng.lng})</p>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div bind:this={mapElement} />
|
<div bind:this={mapElement} />
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import wasmPack from 'vite-plugin-wasm-pack';
|
import wasmPack from 'vite-plugin-wasm-pack';
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
|
|
||||||
export default defineConfig({
|
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
Loading…
Reference in New Issue
Block a user