t-comm
Version:
专业、稳定、纯粹的工具库
56 lines (53 loc) • 2.14 kB
JavaScript
import { getEnvUAType } from '../env/env.mjs';
import TencentMapApiLocation$1 from './platform/h5-geolocation-location.mjs';
import MsdkLocation from './platform/msdk-location.mjs';
import SlugSdkLocation from './platform/slug-sdk-location.mjs';
import TencentMapApiLocation from './platform/tencent-map-api-location.mjs';
import TencentMapLocation from './platform/tencent-map-location.mjs';
import TipSdkLocation from './platform/tip-sdk-location.mjs';
import WechatSdkLocation from './platform/wechat-sdk-location.mjs';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import './location-interface.mjs';
import '../msdk/msdk.mjs';
import '@babel/runtime/helpers/typeof';
import '../loader/little-loader.mjs';
import 'axios';
import '../city/city.mjs';
import '../city/data.mjs';
import '../lodash-mini/get.mjs';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/toArray';
import '../loader/loader-unity.mjs';
import '../loader/loader.mjs';
function locationHandle(options) {
var _getEnvUAType = getEnvUAType(),
isInGame = _getEnvUAType.isInGame,
isMsdkX = _getEnvUAType.isMsdkX,
isWeixin = _getEnvUAType.isWeixin,
isSlugSdk = _getEnvUAType.isSlugSdk,
isMiniProgram = _getEnvUAType.isMiniProgram;
var handle;
if (options.useWxSdk && isWeixin) {
handle = new WechatSdkLocation();
} else if (options.useSlugSdk && isSlugSdk) {
handle = new SlugSdkLocation();
} else if (options.useMsdk && isMsdkX) {
handle = new MsdkLocation();
} else if (options.useTipSdk && isInGame) {
handle = new TipSdkLocation();
} else if (options.useTencentMapApi) {
handle = new TencentMapApiLocation();
} else if (options.useH5Geolocation && isMiniProgram) {
handle = new TencentMapApiLocation$1();
} else if (options.useTencentMap) {
handle = new TencentMapLocation();
}
return handle;
}
locationHandle.failHandle = function (options, handle) {
if (options.useTencentMapIfFail && handle && handle instanceof TipSdkLocation) {
return new TencentMapLocation();
}
};
export { locationHandle as default };