@mapbox/react-map-gl
Version:
A React wrapper for MapboxGL-js and overlay API.
25 lines (23 loc) • 761 B
JavaScript
/* global window */
var supported;
export 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