Skip to content

UseWatchGeolocation

katanakit-js / useWatchGeolocation

function useWatchGeolocation(callback, options?): (() => void) | null;

Defined in: infrastructure/sensors/sensors.service.ts:152

Continuously watches the device’s geographic position.

Parameter Type Description
callback (position) => void Called with a GeoPosition on each position update.
options? PositionOptions Optional PositionOptions to override defaults.

(() => void) | null

A cleanup function that stops watching, or null if unavailable.

const stop = useWatchGeolocation((pos) => {
console.log("Moved to", pos.lat, pos.lng);
});
// later:
stop?.();