igorpreston / ember-cli-geo

Geolocation service for Ember.js web apps
MIT License
50 stars 16 forks source link

Add service method to `clearWatch` #6

Closed jcypret closed 7 years ago

jcypret commented 8 years ago

Currently, there's no way to stop watching a users location. This is done by calling navigator.geolocation.clearWatch(id) (https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/clearWatch). However, the watchPosition id is not currently being stored, so there is no id to use for clearing it.

The watchPosition id is returned from the navigator.geolocation.watchPosition method (https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/watchPosition), so the return value could be stored on the service (https://github.com/igorpreston/ember-cli-geo/blob/c68a1d54ea6d96e2e5262f68613ed91e63a6df3b/addon/services/geolocation.js#L22).

It would then be convenient to round out the API with a public method to stopping tracking the location. The method would just need to call clearWatch with the stored watchPosition id.

andreisebastianc commented 8 years ago

https://github.com/igorpreston/ember-cli-geo/pull/7 this takes care of it

andreisebastianc commented 8 years ago

I'll push an update to the docs and then this can be closed.