Download packages/tauri-plugins/examples/api/src/views/Geolocation.svelte from echodict/readest: direct link, hf CLI and curl.
- Browser
- Download file 680 Bytes
-
https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/examples/api/src/views/Geolocation.svelte
- Command line
-
hf download hf://datasets/echodict/readest/packages/tauri-plugins/examples/api/src/views/Geolocation.svelte
-
curl -L -o Geolocation.svelte https://huggingface.co/datasets/echodict/readest/resolve/main/packages/tauri-plugins/examples/api/src/views/Geolocation.svelte
680 Bytes
| <script> | |
| import { | |
| checkPermissions, | |
| requestPermissions, | |
| getCurrentPosition | |
| } from '@tauri-apps/plugin-geolocation' | |
| export let onMessage | |
| async function getPosition() { | |
| let permissions = await checkPermissions() | |
| if ( | |
| permissions.location === 'prompt' || | |
| permissions.location === 'prompt-with-rationale' | |
| ) { | |
| permissions = await requestPermissions(['location']) | |
| } | |
| if (permissions.location === 'granted') { | |
| getCurrentPosition().then(onMessage).catch(onMessage) | |
| } else { | |
| onMessage('permission denied') | |
| } | |
| } | |
| </script> | |
| <button class="btn" id="cli-matches" on:click={getPosition}> | |
| Get Position | |
| </button> | |