scaccogatto/vue-geolocation

Unable to continuously obtain coordinates from this.$watchLocation(opts)

Opened this issue · 2 comments

Hello,

Is it possible to continuously obtain new coordinate values from this.$watchLocation(opts)?
The current design using promises seems to only return a value at first invocation, then does not supply any new coordinates thereafter, making it no different from this.$getLocation(opts).

You are right, the watch feature was introduced by @hkd987 and it is not what it should be. We could use reactive data and provide a real watch experience for this plugin. PR are welcome!

How are you calling the method? From what part of vue?

I’d like to get more details maybe I can come up with a better solution.

When I tested this I was only able to get the watch position to work from a cell phone. When used on a desktop it will only work when you open a new tab.

https://stackoverflow.com/questions/24019286/navigator-geolocation-watchposition-frequency

Have you tried putting the call inside a computed property?

Also just as a side not I have no idea why I wrote the code this way. It could be made better. I’ll do a little research today.