UseWatchGeolocation
katanakit-js / useWatchGeolocation
Function: useWatchGeolocation()
Section titled “Function: useWatchGeolocation()”function useWatchGeolocation(callback, options?): (() => void) | null;Defined in: infrastructure/sensors/sensors.service.ts:152
Continuously watches the device’s geographic position.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
callback |
(position) => void |
Called with a GeoPosition on each position update. |
options? |
PositionOptions |
Optional PositionOptions to override defaults. |
Returns
Section titled “Returns”(() => void) | null
A cleanup function that stops watching, or null if unavailable.
Example
Section titled “Example”const stop = useWatchGeolocation((pos) => { console.log("Moved to", pos.lat, pos.lng);});// later:stop?.();