All Projects → scaccogatto → vue-geolocation

scaccogatto / vue-geolocation

Licence: MIT license
ask to your users their coordinates, and wrap them into a Promise

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-geolocation

fetchye
✨ If you know how to use Fetch, you know how to use Fetchye [fetch-yae]. Simple React Hooks, Centralized Cache, Infinitely Extensible.
Stars: ✭ 36 (-59.09%)
Mutual labels:  promise
ipinfodb-php
PHP library to query free IPInfoDB API service.
Stars: ✭ 15 (-82.95%)
Mutual labels:  geolocation
market-pricing
Wrapper for the unofficial Steam Market Pricing API
Stars: ✭ 21 (-76.14%)
Mutual labels:  promise
promise4j
Fluent promise framework for Java
Stars: ✭ 20 (-77.27%)
Mutual labels:  promise
promised-hooks
Middleware utility for your Promises
Stars: ✭ 25 (-71.59%)
Mutual labels:  promise
bluff
🙏 Promise A+ implementation
Stars: ✭ 14 (-84.09%)
Mutual labels:  promise
google-maps-places-geolocation-for-your-ionic-app
Ionic example app of how to add Google maps, places, geolocation and related features into an Ionic Framework app.
Stars: ✭ 13 (-85.23%)
Mutual labels:  geolocation
ipinfo
A wrapper around the ipinfo.io services
Stars: ✭ 51 (-42.05%)
Mutual labels:  geolocation
promiviz
Visualize JavaScript Promises on the browser. Visualize the JavaScript Promise APIs and learn. It is a playground to learn about promises faster, ever!
Stars: ✭ 79 (-10.23%)
Mutual labels:  promise
LaravelPostcodes
A service wrapper around postcodes.io
Stars: ✭ 73 (-17.05%)
Mutual labels:  geolocation
radar-sdk-android
Android SDK for Radar, the leading geofencing and location tracking platform
Stars: ✭ 57 (-35.23%)
Mutual labels:  geolocation
promise-all-properties
A helper function that recevies an object with a promise in each property and returns a promise that resolves to an object with the same properties and the resolved values of the promises
Stars: ✭ 26 (-70.45%)
Mutual labels:  promise
parley
Flow control harness for implementors. Builds a Deferred object that supports async/await, promise chaining, and conventional Node callbacks.
Stars: ✭ 23 (-73.86%)
Mutual labels:  promise
go
Official Golang client library for the ipdata API
Stars: ✭ 21 (-76.14%)
Mutual labels:  geolocation
alls
Just another library with the sole purpose of waiting till all promises to complete. Nothing more, Nothing less.
Stars: ✭ 13 (-85.23%)
Mutual labels:  promise
GoGoCarto
This repo has been moved to https://gitlab.adullact.net/pixelhumain/GoGoCarto since 17/12/2018
Stars: ✭ 43 (-51.14%)
Mutual labels:  geolocation
exploring-my-neighborhood
track all your moves and visualize them!
Stars: ✭ 16 (-81.82%)
Mutual labels:  geolocation
promise-yes
Slide about how to use Promise in JavaScript.
Stars: ✭ 13 (-85.23%)
Mutual labels:  promise
mmdb-server
mmdb-server is an open source fast API server to lookup IP addresses for their geographic location.
Stars: ✭ 69 (-21.59%)
Mutual labels:  geolocation
promise-waterfall
promise-waterfall extends promise utilities with sequential flow control function like async.waterfall
Stars: ✭ 28 (-68.18%)
Mutual labels:  promise

vue-geolocation

ask to your users their coordinates, and wrap them into a Promise

Build Status

Plugin install

yarn add vue-browser-geolocation

or

npm install vue-browser-geolocation

in your main.js

import VueGeolocation from 'vue-browser-geolocation';
Vue.use(VueGeolocation);

Usage

Inside a Vue Component

this.$getLocation(options)
  .then(coordinates => {
    console.log(coordinates);
  });

Will prompt a Geolocation Request

or to watch a location

this.$watchLocation(options)
  .then(coordinates => {
    console.log(coordinates);
  })

you can clear the watcher

this.$clearLocationWatch(watchID)

please refer to the Geolocation docs to reference how to get a watchID

Options

See PositionOptions

Example

this.$getLocation({
	enableHighAccuracy: bool, //defaults to false
	timeout: Infinity, //defaults to Infinity
	maximumAge: int //defaults to 0
	
})
  .then(coordinates => {
    console.log(coordinates);
  });

Forcing failure in automated testing

If you need to setup automated testing in your application, and you need to force failure of geolocation to test how your application behaves, you can pass a second argument (forceReject) to this.$getGelocation and this.$watchLocation:

this.$getLocation(positionOptions, forceReject)

this.$watchLocation(positionOptions, forceReject)

if the parameter is true, the promise will be rejected with a special error message.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].