UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

45 lines (42 loc) 1.39 kB
import _typeof from '@babel/runtime/helpers/typeof'; import { callJsBrowserAdapter } from '../../msdk/msdk.mjs'; import { LocationFlag } from '../location-interface.mjs'; import '../../env/env.mjs'; import '../../loader/little-loader.mjs'; var SlugSdkLocation = /** @class */function () { function SlugSdkLocation() {} SlugSdkLocation.prototype.getLocation = function () { return new Promise(function (resolve, reject) { callJsBrowserAdapter().then(function () { if (_typeof(window.customBrowserInterface) === 'object') { window.customBrowserInterface.getLocationInfo(function (result) { if ((result === null || result === void 0 ? void 0 : result.code) == 1) { var location_1 = { lat: result.latitude, lng: result.longitude }; resolve({ location: location_1, flag: LocationFlag.LocationSuccess }); } else { reject({ flag: result.code }); } }); } else { reject({ flag: LocationFlag.LocationFailed }); } })["catch"](function () { reject({ flag: LocationFlag.LocationFailed }); }); }); }; return SlugSdkLocation; }(); export { SlugSdkLocation as default };