import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
import _createClass from '@babel/runtime/helpers/createClass';
import { LocationFlag } from '../location-interface.mjs';

var TencentMapApiLocation = /*#__PURE__*/function () {
  function TencentMapApiLocation() {
    _classCallCheck(this, TencentMapApiLocation);
  }
  return _createClass(TencentMapApiLocation, [{
    key: "getLocation",
    value: function getLocation() {
      return new Promise(function (resolve, reject) {
        function geoShowPosition(position) {
          if (position) {
            var location = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };
            resolve({
              location: location,
              flag: LocationFlag.LocationSuccess
            });
          } else {
            reject();
          }
        }
        function geoShowError(error) {
          console.log("getPosError:".concat(error.code, ",").concat(navigator.geolocation, ",").concat(error.message));
          reject();
        }
        navigator.geolocation.getCurrentPosition(geoShowPosition, geoShowError);
      });
    }
  }]);
}();

export { TencentMapApiLocation as default };
