fix(geolocation): #3303 geolocation watchPosition return type (#3470)

* fix #3303 geolocation watchPosition return type

* watchPosition align docs
This commit is contained in:
David Boho 2020-08-14 17:38:14 +02:00 committed by GitHub
parent b0ffb0ec4a
commit 579170a99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -192,10 +192,10 @@ export class Geolocation extends IonicNativePlugin {
* ``` * ```
* *
* @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions). * @param {GeolocationOptions} options The [geolocation options](https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions).
* @returns {Observable<Geoposition>} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors. * @returns {Observable<Geoposition | PositionError>} Returns an Observable that notifies with the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) of the device, or errors.
*/ */
watchPosition(options?: GeolocationOptions): Observable<Geoposition> { watchPosition(options?: GeolocationOptions): Observable<Geoposition | PositionError> {
return new Observable<Geoposition>((observer: any) => { return new Observable<Geoposition | PositionError>((observer: any) => {
const watchId = navigator.geolocation.watchPosition( const watchId = navigator.geolocation.watchPosition(
observer.next.bind(observer), observer.next.bind(observer),
observer.next.bind(observer), observer.next.bind(observer),