Primitives / foldkit-primitives/device
Geolocation
const · packages/primitives/src/device/geolocation.ts:88
| Args | none |
|---|---|
| Model | { status: "unknown" | "ready" | "denied", coords: { readonly latitude: number; readonly longitude: number; readonly accuracy: number; } | null, lastError: string | null } |
| Messages | Failed { message: string }, Located { latitude: number, longitude: number, accuracy: number }, Denied |
Its full type
const Geolocation: Bundle.Bundle<
'Geolocation',
void,
{
readonly status: 'unknown' | 'ready' | 'denied'
readonly coords: {
readonly latitude: number
readonly longitude: number
readonly accuracy: number
} | null
readonly lastError: string | null
},
| { readonly _tag: 'Failed'; readonly message: string }
| {
readonly _tag: 'Located'
readonly latitude: number
readonly longitude: number
readonly accuracy: number
}
| { readonly _tag: 'Denied' },
never,
never,
never,
void,
{},
{}
>Geolocation as a bundle: the device position in the Model, watched while placed. Permission denial is its own status (actionable UI); transient failures keep the last fix and note the error. No geolocation API yields an empty stream instead of throwing.
In the guides
- Find one by the jobPrimitives / foldkit-primitives
- The mapPrimitives / foldkit-primitives
- foldkit-primitives/devicePrimitives / Device