2023-04-06 01:33:08 +02:00
|
|
|
<script lang="ts">
|
2025-01-29 21:10:24 +01:00
|
|
|
import { GeoLocationState } from "../Logic/State/GeoLocationState"
|
2024-11-24 23:19:17 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
let origlog = console.log
|
2024-11-24 23:19:17 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
let logs: string[] = []
|
2024-11-24 23:19:17 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
function log(...items) {
|
|
|
|
origlog(...items)
|
|
|
|
logs.push(items.join(" "))
|
|
|
|
}
|
2024-12-10 02:38:00 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
console.log = log
|
2025-01-29 21:15:16 +01:00
|
|
|
console.error = (...items) => log("ERR: ", ...items)
|
|
|
|
console.warn = (...items) => log("WARN: ", ...items)
|
2024-11-24 23:19:17 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
const st = new GeoLocationState()
|
|
|
|
const av = st.gpsAvailable
|
|
|
|
const loc = st.currentGPSLocation
|
|
|
|
const permission = st.permission
|
2024-02-22 18:58:34 +01:00
|
|
|
</script>
|
2024-11-24 23:19:17 +01:00
|
|
|
|
2025-01-29 21:10:24 +01:00
|
|
|
<button on:click={() => st.requestPermission()}>Get geolocation</button>
|
2025-02-10 02:04:58 +01:00
|
|
|
Permission:
|
|
|
|
<code>{$permission}</code>
|
|
|
|
Available:
|
|
|
|
<code>{$av}</code>
|
|
|
|
Location:
|
|
|
|
<code>{JSON.stringify($loc)}</code>
|
2025-01-29 21:10:24 +01:00
|
|
|
<ol>
|
|
|
|
{#each logs as log}
|
|
|
|
<li>{log}</li>
|
2024-11-24 23:19:17 +01:00
|
|
|
{/each}
|
2025-01-29 21:10:24 +01:00
|
|
|
</ol>
|