Skip to content

location

const location: object

Defined in: index.ts:17

Geolocation helpers. Browser-only: they use navigator.geolocation and navigator.permissions, so they do not work in Node.js.

getCurrent: (logger) => Promise<IGeolocationCoordinates> = getCurrentLocation

Resolves the current position, or a zeroed fallback when permission is denied or the lookup fails.

LocationLogger = consoleLogger

Promise<IGeolocationCoordinates>

import { location } from "@theholocron/location-utils";
const coords = await location.getCurrent();
console.log(coords.latitude, coords.longitude);