house-middleware-sdk
Version:
58 hosue rn native sdk
42 lines (37 loc) • 1.07 kB
JavaScript
/*
* @method getLocation 获取定位信息
*/
export function getLocation(callback) {
require("../utils/findImpl")
.default(
() => getLocationWbImpl(callback),
() => getLocationAjkImpl(callback),
() => getLocationYdjjrImpl(callback),
() => getLocationWbtzImpl(callback)
);
}
function getLocationWbImpl(callback) {
require("@w/wbapp/src/sdk/getLocation").getLocation((res) => {
callback(res.content)
});
}
function getLocationAjkImpl(callback) {
require("ajkapp").getLocation(callback);
}
function getLocationYdjjrImpl(callback) {
require('react-native').NativeModules?.BrokerLocation?.request(callback);
}
//58同镇
function getLocationWbtzImpl(callback) {
// require('../utils/network')
// .getPublicParamsAndHeader()
// .then((initParams) => {
// }).catch((error) => {
// });
try {
throw new ReferenceError("When the platform is towned, 'getLocation(callback)' returns an empty object '{}', whose value is in the default header!")
} catch (error) {
console.error(error);
}
callback({})
}