diff --git a/src/ol/browserfeature.exports b/src/ol/browserfeature.exports index b1ff1760c6..ce7d6c8f13 100644 --- a/src/ol/browserfeature.exports +++ b/src/ol/browserfeature.exports @@ -2,4 +2,5 @@ @exportProperty ol.BrowserFeature.DEVICE_PIXEL_RATIO @exportProperty ol.BrowserFeature.HAS_TOUCH @exportProperty ol.BrowserFeature.HAS_DEVICE_ORIENTATION +@exportProperty ol.BrowserFeature.HAS_GEOLOCATION @exportProperty ol.BrowserFeature.HAS_WEBGL diff --git a/src/ol/browserfeature.js b/src/ol/browserfeature.js index c145ebbb37..a3ae7d6eb5 100644 --- a/src/ol/browserfeature.js +++ b/src/ol/browserfeature.js @@ -31,6 +31,15 @@ ol.BrowserFeature.HAS_DEVICE_ORIENTATION = 'DeviceOrientationEvent' in goog.global; +/** + * Is HTML5 geolocation supported in the current browser? + * @const + * @type {boolean} + * @todo stability experimental + */ +ol.BrowserFeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator; + + /** * True if browser supports touch events. * @const diff --git a/src/ol/geolocation.exports b/src/ol/geolocation.exports index 398f9fefea..adc26edc01 100644 --- a/src/ol/geolocation.exports +++ b/src/ol/geolocation.exports @@ -1,2 +1 @@ @exportSymbol ol.Geolocation -@exportSymbol ol.Geolocation.SUPPORTED ol.Geolocation.SUPPORTED diff --git a/src/ol/geolocation.js b/src/ol/geolocation.js index ffb7a11638..36ff83906c 100644 --- a/src/ol/geolocation.js +++ b/src/ol/geolocation.js @@ -6,6 +6,7 @@ goog.provide('ol.GeolocationProperty'); goog.require('goog.events'); goog.require('goog.events.EventType'); goog.require('goog.math'); +goog.require('ol.BrowserFeature'); goog.require('ol.Coordinate'); goog.require('ol.Object'); goog.require('ol.proj'); @@ -140,7 +141,7 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() { * @private */ ol.Geolocation.prototype.handleTrackingChanged_ = function() { - if (ol.Geolocation.SUPPORTED) { + if (ol.BrowserFeature.HAS_GEOLOCATION) { var tracking = this.getTracking(); if (tracking && !goog.isDef(this.watchId_)) { this.watchId_ = goog.global.navigator.geolocation.watchPosition( @@ -155,15 +156,6 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() { }; -/** - * Is HTML5 geolocation supported in the current browser? - * @const - * @type {boolean} - * @todo stability experimental - */ -ol.Geolocation.SUPPORTED = 'geolocation' in goog.global.navigator; - - /** * @private * @param {GeolocationPosition} position position event.