@mapbox/react-map-gl
Version:
A React wrapper for MapboxGL-js and overlay API.
33 lines (28 loc) • 893 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isGeolocationSupported = isGeolocationSupported;
/* global window */
var supported;
function isGeolocationSupported() {
// not necessary to check again
if (supported !== undefined) {
return Promise.resolve(supported);
}
if (window.navigator.permissions !== undefined) {
// navigator.permissions has incomplete browser support
// http://caniuse.com/#feat=permissions-api
// Test for the case where a browser disables Geolocation because of an
// insecure origin
return window.navigator.permissions.query({
name: 'geolocation'
}).then(function (p) {
supported = p.state !== 'denied';
return supported;
});
}
supported = Boolean(window.navigator.geolocation);
return Promise.resolve(supported);
}
//# sourceMappingURL=geolocate-utils.js.map