UseGetGeolocation
katanakit-js / useGetGeolocation
Function: useGetGeolocation()
Section titled “Function: useGetGeolocation()”function useGetGeolocation(options?): Promise< | { accuracy: number; lat: number; lng: number;}| null>;Defined in: infrastructure/sensors/sensors.service.ts:115
Gets the device’s current geographic position once.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? |
PositionOptions |
Optional PositionOptions to override defaults. |
Returns
Section titled “Returns”Promise<
| {
accuracy: number;
lat: number;
lng: number;
}
| null>
A GeoPosition object or null on error / unavailability.
Example
Section titled “Example”const pos = await useGetGeolocation({ enableHighAccuracy: true });if (pos) console.log(`${pos.lat}, ${pos.lng}`);