Skip to content

Vue hook for getting geolocation 🗺️

License

Notifications You must be signed in to change notification settings

benceHornyak/vx-geolocation

Repository files navigation

vx-geolocation

Tracks user's location via reactive variables 🗺️

Install

npm install vx-geolocation

Usage

Using this tiny package is fairly simple:

import { useGeolocation } from "vx-geolocation";
...
// then you can call the hook
const { position, error } = useGeolocation();

Documentation

Under the hood a Browser API is used to get the location data (See: MDN docs for more info).

The hook returns two reactive variables: positions and error.

There is a small App.vue file so you can play with it easily locally.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Type-Check, Compile and Minify for Production

npm run build

Lint with ESLint

npm run lint