Skip to content
0

katanakit-js / useWatchGeolocation

Function: useWatchGeolocation() ​

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

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

Continuously watches the device's geographic position.

Parameters ​

ParameterTypeDescription
callback(position) => voidCalled with a GeoPosition on each position update.
options?PositionOptionsOptional PositionOptions to override defaults.

Returns ​

(() => void) | null

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

Example ​

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

Released under the MIT License.