GeolocationService

Wraps the Geolocation API with typed Promises and Observables. Supports one-time position queries and continuous position watching with automatic cleanup.

API Variant
TypeScriptexample.ts
import { GeolocationService } from '@angular-helpers/browser-web-apis'

# Methods

MethodSignatureReturnsDescription
getCurrentPositiongetCurrentPosition(options?: PositionOptions): Promise<GeolocationPosition>Promise<GeolocationPosition>Public method getCurrentPosition.
watchPositionwatchPosition(options?: PositionOptions): Observable<GeolocationPosition>Observable<GeolocationPosition>Public method watchPosition.
clearWatchclearWatch(watchId: number): voidvoidPublic method clearWatch.
getNativeGeolocationgetNativeGeolocation(): GeolocationGeolocationPublic method getNativeGeolocation.
LCP N/A
CLS N/A
INP N/A