@arcteryx/js-geolocation
v1.4.0
Published
ARCTERYX JavaScript library to get the geolocation for a user by calling the /api/geolocation from the [edge in Fastly](https://developer.fastly.com/solutions/recipes/geo-ip-api-at-the-edge). It will save the geoLocation information in localStorage under
Downloads
1,259
Readme
Arc'teryx Geolocation Library
ARCTERYX JavaScript library to get the geolocation for a user by calling the /api/geolocation from the edge in Fastly. It will save the geoLocation information in localStorage under "geolocation" key. It will return the geoLocation from localStorage if it exists. If it's been stored in localStorage for more than 1hr it will fetch it again and store it.
Usage
npm install @arcteryx/js-geolocation
const geoLocation = await getGeolocation();
geoLocation = {
city: "vancouver",
region: "BC",
country_code: "CA",
country_name: "canada",
postalcode: "v5y 1e6",
latitude: "49.270",
longitude: "-123.110",
saveAt: "2020-12-17T11:42:12.803Z"
}
Build and test locally
npm ci
npm run build